Add comparison between joint coordinated from original and converted models
Browse files- convert_to_mixed.py +11 -0
convert_to_mixed.py
CHANGED
|
@@ -55,6 +55,17 @@ def main(args):
|
|
| 55 |
is_close = np.allclose(original_result[0], converted_result[0], rtol=args.rtol, atol=args.atol)
|
| 56 |
print(f"Validation result: {'Success' if is_close else 'Failure'}")
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
if __name__ == "__main__":
|
| 59 |
parser = argparse.ArgumentParser(description="Convert an ONNX model to mixed precision format.")
|
| 60 |
parser.add_argument("source_model_path", type=str, help="Path to the source ONNX model.")
|
|
|
|
| 55 |
is_close = np.allclose(original_result[0], converted_result[0], rtol=args.rtol, atol=args.atol)
|
| 56 |
print(f"Validation result: {'Success' if is_close else 'Failure'}")
|
| 57 |
|
| 58 |
+
print('Compare Joint Coordinates:')
|
| 59 |
+
original_keypoints, converted_keypoints = original_result[1][0, :, :, :2], converted_result[1][0, :, :, :2]
|
| 60 |
+
for n_det in range(original_keypoints.shape[0]):
|
| 61 |
+
print(f'\tDetection {n_det}:')
|
| 62 |
+
for n_joint in range(original_keypoints.shape[1]):
|
| 63 |
+
original_x, original_y = original_keypoints[n_det][n_joint]
|
| 64 |
+
converted_x, converted_y = converted_keypoints[n_det][n_joint]
|
| 65 |
+
print(f'\t\tJoint {n_joint}:')
|
| 66 |
+
print(f'\t\t\tX: {original_x:.2f}, {converted_x:.2f}')
|
| 67 |
+
print(f'\t\t\tY: {original_y:.2f}, {converted_y:.2f}')
|
| 68 |
+
|
| 69 |
if __name__ == "__main__":
|
| 70 |
parser = argparse.ArgumentParser(description="Convert an ONNX model to mixed precision format.")
|
| 71 |
parser.add_argument("source_model_path", type=str, help="Path to the source ONNX model.")
|