Commit 0dab20c
Return images same mode (initial commit) (#132)
Summary:
## Related Issue
Fixes #{128}
- [x] I have read CONTRIBUTING.md to understand how to contribute to this repository :)
- [x] Add src_mode arg to ret_and_save_image() in image/utils/utils.py
- [x] Pass src_mode arg into ret_and_save_image() from every augmentation except convert_color in image/functional.py (e.g. here for apply_lambda)
- [x] In image test evaluate_class(), assert that the mode of self.img & dst are equal.
- [x] Run image tests, make sure they all pass: python -m unittest discover -s augly/tests/image_tests/ -p "*"
## Unit Tests
If your changes touch the `audio` module, please run all of the `audio` tests and paste the output here. Likewise for `image`, `text`, & `video`. If your changes could affect behavior in multiple modules, please run the tests for all potentially affected modules. If you are unsure of which modules might be affected by your changes, please just run all the unit tests.
### [Image](url)
```bash
python -m unittest discover -s augly/tests/image_tests/ -p "*_test.py"
# Or `python -m unittest discover -s augly/tests/image_tests/ -p "*.py"` to run pytorch test too (must install `torchvision` to run)
```
Test Output:
n/a
## Other testing
N/A
Pull Request resolved: #132
Test Plan:
- Added line to transforms unit test saving dst image in `/tmp/`
- Ran transforms unit test
```
$ manifold rm ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_compose.png && manifold put /tmp/test_compose.png ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_compose.png
$ manifold rm ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_opacity.png && manifold put /tmp/test_opacity.png ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_opacity.png
$ manifold rm ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_overlay_emoji.png && manifold put /tmp/test_overlay_emoji.png ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_overlay_emoji.png
$ manifold rm ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_overlay_image.png && manifold put /tmp/test_overlay_image.png ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_overlay_image.png
$ manifold rm ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_overlay_onto_background_image.png && manifold put /tmp/test_overlay_onto_background_image.png ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_overlay_onto_background_image.png
$ manifold rm ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_overlay_onto_screenshot.png && manifold put /tmp/test_overlay_onto_screenshot.png ai_red_team/tree/augmentations/tests/image/dfdc_expected_output/test_overlay_onto_screenshot.png
```
```
$ rm -rf /home/zoep/.torch/iopath_cache/manifold_cache
$ buck test //aml/augly/tests/image_tests:transforms_unit_test
Summary
Pass: 40
Skip: 2
↻ aml/augly/tests/image_tests:transforms_unit_test - test_RandomEmojiOverlay (augly.tests.image_tests.transforms_unit_test.TransformsImageUnitTest)
↻ aml/augly/tests/image_tests:transforms_unit_test - test_MemeFormat (augly.tests.image_tests.transforms_unit_test.TransformsImageUnitTest)
Omit: 1
{emoji:2702} aml/augly/tests/image_tests:transforms_unit_test - test_OverlayText (augly.tests.image_tests.transforms_unit_test.TransformsImageUnitTest)
ListingSuccess: 1
```
```
$ buck test //aml/augly/tests/image_tests:functional_unit_test
Summary
Pass: 34
Skip: 2
↻ aml/augly/tests/image_tests:functional_unit_test - test_overlay_text (augly.tests.image_tests.functional_unit_test.FunctionalImageUnitTest)
↻ aml/augly/tests/image_tests:functional_unit_test - test_meme_format (augly.tests.image_tests.functional_unit_test.FunctionalImageUnitTest)
ListingSuccess: 1
```
Reviewed By: jbitton
Differential Revision: D31503672
Pulled By: zpapakipos
fbshipit-source-id: afcff9edaf791e2fe9ba3c45dbe9f7228b5f4d7b1 parent 02e4cd5 commit 0dab20c
File tree
9 files changed
+85
-36
lines changed- augly
- assets/tests/image/dfdc_expected_output
- image
- utils
- tests/image_tests
9 files changed
+85
-36
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
0 commit comments