eps696 / aphantasia

CLIP + FFT/DWT/RGB = text to image/video
MIT License
772 stars 105 forks source link

getting this error while running illustrip3d : `!ssize.empty() in function 'resize'` #46

Open hemangjoshi37a opened 1 month ago

hemangjoshi37a commented 1 month ago
-------------------------------------------------------------------------
error                                     Traceback (most recent call last)
Cell In[7], line 30
     27 else:
     28   depthdir = None
---> 30 depth_infer, depth_mask = depth.init_adabins(size=size, model_path='AdaBins_nyu.pt', mask_path=depth_mask_file)
     32 def depth_transform(img_t, depth_infer, depth_mask, size, depthX=0, scale=1., shift=[0,0], colors=1, depth_dir=None, save_num=0):
     33   size2 = [s//2 for s in size]

File ~/aphantasia/depth/depth.py:63, in init_adabins(size, model_path, mask_path, mask_blur, tridepth)
     61 masksize = (830, 500) # it doesn't have to be this exact number, this is just the max for what works at 16:9 for each crop
     62 mask = cv2.imread(mask_path, cv2.IMREAD_GRAYSCALE)
---> 63 mask = cv2.resize(mask, masksize)
     64 mask = cv2.GaussianBlur(mask, (mask_blur,mask_blur),0)
     65 mask = cv2.resize(mask, (size[1][/](https://171.226.153.92:54364/)/2, size[0]//2)) / 255.

error: OpenCV(4.5.1) [/tmp/pip-req-build-ms668fyv/opencv/modules/imgproc/src/resize.cpp:4051](https://171.226.153.92:54364/tmp/pip-req-build-ms668fyv/opencv/modules/imgproc/src/resize.cpp#line=4050): error: (-215:Assertion failed) !ssize.empty() in function 'resize'

I already tried different opencv versions but still same results . please suggest me how to solve this error .

eps696 commented 1 month ago

i see some random url inserted on the line 65 in your error log, which is not in the original code: https://github.com/eps696/aphantasia/blob/575edd631329fd9c3eb4ad73bb7fc64492d338c5/depth/depth.py#L65 considering that error is happening before that line, i suspect there may be more erroneous edits in the repo copy. if you use google drive, i would suggest removing the repo copy from it altogether and start from scratch (to copy a clean codebase).

hemangjoshi37a commented 1 month ago

@eps696 i beleive there sohuld be something like error protection for this in that case it checks the mask file is available if not then use the mask = cv2.resize(mask, (size[1]//2, size[0]//2)) / 255. line .

eps696 commented 1 month ago

thanks for the hint; unfortunately, it's not feasible to safeguard everything (especially against random edits in the open-source code). please let me know if you get any errors running the original code.