Commit 0bfda4c
make image similarity check less sensitive + fix overlay wrap text bug (#258)
Summary:
Pull Request resolved: #258
as part of my personal side quest to make augly's tests pass again, i am making a change to our tests.
## overlay wrap text fix
seems like we were modifying the original image in place for overlay wrap text which is not the augly way (we always copy + modify + return new image), so this change fixes that and also fixes 99% of the image tests.
## imagehash change
currently, to assess image similarity, we use the `np.allclose` function. while that's better / less sensitive than an MD5 hash it's not much better because imperceptible changes can actually have large differences in values between numpy image arrays.
thus, to make augly's tests less affected by slight version updates by PIL or whatever else, we are switching to using imagehash.
we're specifically using the phash - you can read about it here: https://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html
phash isn't a perfect fit though, long term. it's not sensitive to color, scaling, or aspect ratio changes. to deal with the latter two, im keeping in the size equality check. for color, i want to do some more research on what is an efficient way to do this. nonetheless, this is still better than what we currently have right now.
Reviewed By: joelicohk, mayaliliya
Differential Revision: D70137163
fbshipit-source-id: 58571bf95ea601c8b7ce8eb6ab879833ed0990e21 parent 5e00000 commit 0bfda4c
File tree
3 files changed
+11
-6
lines changed- .github/workflows
- augly
- image
- tests/image_tests
3 files changed
+11
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1712 | 1712 | | |
1713 | 1713 | | |
1714 | 1714 | | |
1715 | | - | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
1716 | 1718 | | |
1717 | 1719 | | |
1718 | 1720 | | |
| |||
1726 | 1728 | | |
1727 | 1729 | | |
1728 | 1730 | | |
1729 | | - | |
| 1731 | + | |
1730 | 1732 | | |
1731 | 1733 | | |
1732 | 1734 | | |
1733 | | - | |
| 1735 | + | |
1734 | 1736 | | |
1735 | 1737 | | |
1736 | 1738 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
0 commit comments