mrhan1993 / Fooocus-API

FastAPI powered API for Fooocus
GNU General Public License v3.0
505 stars 132 forks source link

Worker error: operands could not be broadcast together with shapes (691,537) (1152,896) #294

Closed bsormagec closed 2 months ago

bsormagec commented 2 months ago

When I try to use /image-inpaint-outpaint endpoint with mask, it returns that error. but it works on fooocus, broken on API only did you skip something ? @mrhan1993

mrhan1993 commented 2 months ago

Is ok for me, what is you version and requests?

图片

bsormagec commented 2 months ago

Latest version and use different size mask and image.

mrhan1993 commented 2 months ago

Confirmed. fix it later.

mrhan1993 commented 2 months ago

only one line changed, you can have a try.

work.py, line 412

inpaint_mask = np.maximum(inpaint_mask, inpaint_mask_image_upload)

to

inpaint_mask = np.maximum(np.zeros(shape=(W, H), dtype=np.uint8), inpaint_mask_image_upload)

This is because in Fooocus webui , when you choice upload mask, app will generate a empty mask and merge with resized mask you upload. It uses two variables named inpaint_mask and inpaint_mask_image_upload to represent the two mask

Since version 0.3.29 in Fooocus-API, The logic of worker has changed, and we have no inpaint_mask_image_upload, It is generated by the program automatically resize by inpaint_mask in worker.py, As a result, there will be size inconsistencies in the final merger.

bsormagec commented 2 months ago

Thank you my friend.

bsormagec commented 2 months ago

now have same issue on input_image. :D trying to find which line is this.

Worker error: operands could not be broadcast together with shapes (1440,1800) (1800,1440)

I fixed it on https://github.com/mrhan1993/Fooocus-API/pull/300 @mrhan1993 merge it then it works.

mrhan1993 commented 2 months ago

now have same issue on input_image. :D trying to find which line is this.

Worker error: operands could not be broadcast together with shapes (1440,1800) (1800,1440)

I fixed it on #300 @mrhan1993 merge it then it works.

My mistake :joy: