levindabhi / cloth-segmentation

This repo contains code and a pre-trained model for clothes segmentation.
MIT License
565 stars 102 forks source link

final_label = first_channel + second_channel * 2 + third_channel * 3 conflict_mask = (final_label <= 3).astype("uint8") final_label = (conflict_mask) * final_label + (1 - conflict_mask) * 1 target_tensor = torch.as_tensor(final_label, dtype=torch.int64) #18

Closed DWCTOD closed 1 year ago

DWCTOD commented 1 year ago

Hi, I am very puzzled about the meaning of this code in "data/aligned_dataset.py".

`final_label = first_channel + second_channel 2 + third_channel 3

    conflict_mask = (final_label <= 3).astype("uint8")

    final_label = (conflict_mask) * final_label + (1 - conflict_mask) * 1

    target_tensor = torch.as_tensor(final_label, dtype=torch.int64)`

if I want to add another label , is this OK? `
final_label = first_channel + second_channel 2 + third_channel 3 + fourth_channel * 4

    conflict_mask = (final_label <= 4).astype("uint8") # TODO

    final_label = (conflict_mask) * final_label + (1 - conflict_mask) * 1

    target_tensor = torch.as_tensor(final_label, dtype=torch.int64)`

I would appreciate your response. Thank you.