-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use frozen NumPy array for ImageDecoder backend test if no Pillow #5511
Conversation
…opencv-python Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, these test data are actually image so the array is quite big. They look very unorganized in the introduced Python file: image_decoder_data.py with 35637 lines... If anyone has better idea to handle them, feel free to let me know. Thanks!
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
Can we use smaller images? Make just a few pixels? |
@jcwchen validated this branch fixes the underlying issue. |
Co-authored-by: Aditya Goel <48102515+adityagoel4512@users.noreply.github.com> Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use smaller images? Make just a few pixels?
Good question. Now by default generate_test_data is using 40x40, which is sort of in the middle, but I don't have proper number in mind. Ideally the size of image should be large enough for runtime to test. @jantonguirao do you think it's a good idea to shrink the test image a bit?
@lutzroeder Great! Thank you for the validation. |
@jcwchen We could reduce the image size to something like 32x32, but I wouldn't go much smaller than that. |
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
…into jcw/freeze-cv2-input
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcwchen We could reduce the image size to something like 32x32, but I wouldn't go much smaller than that.
Thank you for the suggestion! I have used 32x32 instead of 40x40 and now the used lines in that Python file was reduced from 35637 lines to 23,604 lines.
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
The proposal seems rather complex to me. Why not using pillow instead of opencv? |
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
As @justinchuby suggested, I turned off black formatter for image_decoder_data.py and rearranged those large NumPy arrays. Now the code lines was decreased from 23,604 to 5,134, which is now previewable in this PR. @onnx/sig-operators-approvers PTAL. Thanks! |
Would be nice to wait for #5555 because there are slight changes in values |
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com> # Conflicts: # docs/Operators.md # docs/TestCoverage.md # onnx/backend/test/case/node/image_decoder.py # onnx/backend/test/data/node/test_image_decoder_decode_bmp_rgb/test_data_set_0/input_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_jpeg2k_rgb/model.onnx # onnx/backend/test/data/node/test_image_decoder_decode_jpeg2k_rgb/test_data_set_0/input_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_jpeg2k_rgb/test_data_set_0/output_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_bgr/model.onnx # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_bgr/test_data_set_0/input_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_bgr/test_data_set_0/output_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_grayscale/model.onnx # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_grayscale/test_data_set_0/input_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_grayscale/test_data_set_0/output_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_rgb/model.onnx # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_rgb/test_data_set_0/input_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_jpeg_rgb/test_data_set_0/output_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_png_rgb/model.onnx # onnx/backend/test/data/node/test_image_decoder_decode_png_rgb/test_data_set_0/input_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_tiff_rgb/model.onnx # onnx/backend/test/data/node/test_image_decoder_decode_tiff_rgb/test_data_set_0/input_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_webp_rgb/model.onnx # onnx/backend/test/data/node/test_image_decoder_decode_webp_rgb/test_data_set_0/input_0.pb # onnx/backend/test/data/node/test_image_decoder_decode_webp_rgb/test_data_set_0/output_0.pb
…into jcw/freeze-cv2-input
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
Signed-off-by: Chun-Wei Chen <jacky82226@gmail.com>
I have updated _image_decoder_data.py accordingly with the new data from #5555 (created from Pillow). Also CI pipeline will test with/without pillow with node test generation. If no one has other concern for this PR, I will forward this PR by the end of today. Thank you all for the reviews! |
Description
Motivation and Context
Similar to #5498. Hopefully this PR can entirely fix #5491.
Ideally test generation should be as simple as possible without other new dependency especially that dependency was not used in other places (reference will only use pillow when needed). Let's merge this PR first and later I will have another PR to freeze input/output as a pure NumPy array and simply keep generate_checkerboard/generate_test_data for future reference.