Skip to content

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

@lQingRu

Description

@lQingRu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions