diff now accounting for flip
"execution_count": null,
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "def determine_corrected_diff(predicted_parameters, ground_truth_parameters):\n",
+ " flipped_predicted_parameters = flip_parameters(predicted_parameters)\n",
+ " \n",
+ " non_flipped_diff = determine_diff_with_rotation(predicted_parameters, ground_truth_parameters)\n",
+ " flipped_diff = determine_diff_with_rotation(flipped_predicted_parameters, ground_truth_parameters)\n",
+ " \n",
+ " non_flipped_sum_sqrd = tf.reduce_sum(\n",
+ " non_flipped_diff**2, axis=-1\n",
+ " )\n",
+ " flipped_sum_sqrd = tf.reduce_sum(\n",
+ " flipped_diff**2, axis=-1\n",
+ " )\n",
+ " \n",
+ " minimisation_stack = tf.stack([\n",
+ " non_flipped_sum_sqrd, flipped_sum_sqrd\n",
+ " ])\n",
+ "# print(minimisation_stack)\n",
+ " \n",
+ " min_index = tf.argmin(minimisation_stack, axis=0)\n",
+ " \n",
+ "# print(min_index)\n",
+ " \n",
+ " both_diffs = tf.stack([\n",
+ " non_flipped_diff, flipped_diff\n",
+ " ])\n",
+ "# print(both_diffs.numpy()[min_index, :, :])\n",
+ " \n",
+ " diff = tf.convert_to_tensor(both_diffs.numpy()[min_index, :, :])\n",
+ " return diff\n",
+ "\n",
+ "\n",
+ "\n",
+ "for parameters, img in create_pipeline_dataset(4).take(1):\n",
+ " \n",
+ " flipped_parameters = flip_parameters(parameters)\n",
+ " print(determine_corrected_diff(parameters, parameters))\n",
+ "# print(determine_corrected_diff(parameters, flipped_parameters))\n",
+ "# print(determine_corrected_diff(flipped_parameters, parameters))"
+ ]
},
{
"cell_type": "code",
