NVIDIA / FastPhotoStyle

Style transfer, deep learning, feature transform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SEGMENTATION with label masks: Value Error: cannot reshape array of size 1228800 into shape (409600,)

lQingRu opened this issue · comments

Used .jpg for label maps, style image, and content image.
(demo_multipy.py is just a copied version of demo.py, just edited to suit multiple images)

Did changes mentioned in #55 (i.e. remove mode='RGB'), and also #56 (changing for t_cont_seg and t_styl_seg doesn't help since issue is on o_cont_mask) but issue persisted:

Elapsed time in stylization: 0.032001 Traceback (most recent call last): File "demo_multiple.py", line 116, in <module> no_post=args.no_post File "/home/user/repository/image_enhancement/FastPhotoStyle/process_stylization.py", line 140, in stylization File "/home/user/repository/image_enhancement/FastPhotoStyle/photo_wct.py", line 21, in transform self.__compute_label_info(cont_seg, styl_seg) File "/home/user/repository/image_enhancement/FastPhotoStyle/photo_wct.py", line 104, in __compute_label_info o_cont_mask = np.where(cont_seg.reshape(cont_seg.shape[0] * cont_seg.shape[1]) == l) ValueError: cannot reshape array of size 1228800 into shape (409600,)

Also tried changing the mode for segmentation image as mentioned in #56, but another issue arise:

Traceback (most recent call last): File "demo_multiple.py", line 116, in <module> no_post=args.no_post File "/home/user/repository/image_enhancement/FastPhotoStyle/process_stylization.py", line 107, in stylization File "/home/user/miniconda3/envs/fastphotostyle3/lib/python3.6/site-packages/PIL/Image.py", line 2661, in fromarray raise ValueError("Too many dimensions: %d > %d." % (ndim, ndmax)) ValueError: Too many dimensions: 3 > 2.

@lQingRu

Were you ever able to resolve this issue?