10up / classifai

Supercharge WordPress Content Workflows and Engagement with Artificial Intelligence.
https://classifaiplugin.com
GNU General Public License v2.0
578 stars 53 forks source link

Smart cropping results not as expected #224

Closed jeffpaul closed 4 years ago

jeffpaul commented 4 years ago

Describe the bug I've tested ClassifAI 1.5.1 on WordPress 5.5.1, 5.4, and 5.3 and am seeing that image tags and alt text work as expected (yay!) but the smart cropping feature isn't providing the desired result (boo!).

Steps to Reproduce

  1. Upload an image to the media library, example: dog-on-red-background
  2. See that cropped thumbnail only captures the top of the dog: bad-crop-result
  3. Click "edit" to see that alt text and image tags worked as expected.

Expected behavior Resulting crop would more closely match what Azure Computer Vision demonstrates on their site: azure-result

Screenshots See in-line in this issue.

Environment information

ClassifAI image processing settings: classifai-image-settings

Additional context

I'll try and dig up the Azure API docs to see if something changed since our original implementation, but open to other triaging to help on this.

jeffpaul commented 4 years ago

Looks like we're referencing v2.0 of their API: https://github.com/10up/classifai/blob/bdee8d423393123dbf6602647cd049b38cd89c0d/includes/Classifai/Providers/Azure/SmartCropping.php#L29

They've since updated to v2.1, v3.0, and have a preview up for v3.1.

jeffpaul commented 4 years ago

Not seeing any major announcements on their blog: https://azure.microsoft.com/en-us/blog/topics/cognitive-services/

helen commented 4 years ago

Well that's a little annoying, maybe we should bump to 3.0 for all of the different endpoints we're using?

jeffpaul commented 4 years ago

@helen that's at least worth researching. Also credit to @oscarssanchez for helping call out this issue and provide good reproduction steps.