Closed burgerlawful closed 8 months ago
Yeah the box values seem to be off for me aswell.
I dug around through the code and found that the box returned is [x, y, width, height]
. But if I transform this to top upper right lower
coordinated as (box[0], box[1], box[0] + box[2], box[1] + box[3])
for cropping, the x0
coordinate in combination with the width seems to always be off. Either it starts too to the right on the left breast and doesn't cover it all on the left side or too to the left on the right breast and doesn't cover it all on the right side. Actually, I ended up noticing the y
height
combination is off aswell.
This used to work perfectly with v2 but in v2 I didn't have to change the box coordinates at all. I could just pass it to crop as they were. It seems the box values changed between v2 and v3
The web version does it perfectly for the same image. The thing I noticed is that the web version shows me a smaller image and mine are large images.
In the pre processing of the image, padding etc is done, thus changing the dimensions of the original input image.
For drawing boxes, these new dimensions have to be mapped back.
I will add a censor() function with these changes in a few days.
The boxes logic is fixed by @pa4y in https://github.com/notAI-tech/NudeNet/pull/128
censor function is now added. refer to readme for example.
I've been playing around with this locally in Python but I can't figure out how to use draw boxes over the image with the values returned from detections. I tried to use some code from the censor function in the v2 branch, but the boxes end up with the wrong dimensions. I'm not sure if it returns the wrong box values or if I am just doing something wrong.