Skip to content

Label Maps Question #55

@dhpollack

Description

@dhpollack

Could you provide an example of using label maps? I have a 3-channel jpg as content, a 3 channel jpg as style, then 3 channel PNGs as label maps, but I get the following error:

Elapsed time in stylization: 0.020673
Traceback (most recent call last):
  File "demo.py", line 43, in <module>
    cuda=args.cuda,
  File "/home/ubuntu/repos/FastPhotoStyle/process_stylization.py", line 62, in stylization
    stylized_img = p_wct.transform(cont_img, styl_img, cont_seg, styl_seg)
  File "/home/ubuntu/repos/FastPhotoStyle/photo_wct.py", line 28, in transform
    self.__compute_label_info(cont_seg, styl_seg)
  File "/home/ubuntu/repos/FastPhotoStyle/photo_wct.py", line 67, 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 1555200 into shape (518400,)

Since there are no examples of using label maps, it's hard for me to figure out if my masks should be 1 channel PNGs or some other format. Perhaps I should also mention that my PNGs only have two labels (background and not background) which are 0 or 255 to create black and white PNG masks.

But an example of using the masks with the appropriate inputs would clear things up and I could quickly solve this problem on my own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions