cost function runs
" \n",
" diff_field_side_lengths = tf.reduce_sum(\n",
" tf.abs(predicted_field_side_lengths - ground_truth_field_side_lengths),\n",
- " axis=-1\n",
+ " axis=0\n",
" )\n",
" \n",
"# print(ground_truth_field_side_lengths)\n",
" diff_field_side_lengths_flipped = tf.reduce_sum(\n",
" tf.abs(predicted_field_side_lengths - tf.reverse(\n",
" ground_truth_field_side_lengths, [0])),\n",
- " axis=-1\n",
+ " axis=0\n",
" )\n",
" \n",
" diff_rotation_flipped = (predicted_rotations - ground_truth_rotations + 90) % 180\n",
" axis=0\n",
" )\n",
" \n",
+ "# print(diff_rotation)\n",
+ "# print(diff_field_side_lengths)\n",
+ "# print(diff_rotation_flipped)\n",
+ "# print(diff_field_side_lengths_flipped)\n",
+ " \n",
" diff_rotation_and_field_sides = tf.reduce_min(tf.stack([\n",
" diff_rotation + diff_field_side_lengths,\n",
" diff_rotation_flipped + diff_field_side_lengths_flipped\n",
" diff_rotation_and_field_sides = determine_diff_rotation_and_flipped(\n",
" predicted_parameters, ground_truth_parameters)\n",
" \n",
- " remaining_predicted = tf.concat([predicted_parameters[:, 0:2], predicted_parameters[5::]])\n",
- " remaining_ground_truth = tf.concat([ground_truth_parameters[:, 0:2], ground_truth_parameters[5::]])\n",
+ " remaining_predicted = tf.concat([predicted_parameters[:, 0:2], predicted_parameters[:, 5::]], axis=-1)\n",
+ " remaining_ground_truth = tf.concat([ground_truth_parameters[:, 0:2], ground_truth_parameters[:, 5::]], axis=-1)\n",
" \n",
" remaining_diff = tf.abs(remaining_predicted - remaining_ground_truth)\n",
" \n",
- " diff = tf.concat([diff_rotation_and_field_sides, remaining_diff])\n",
+ " diff = tf.concat([diff_rotation_and_field_sides[:, None], remaining_diff], axis=-1)\n",
" loss = tf.reduce_mean(diff, axis=-1)\n",
"\n",
" return loss"
