Solved by haoran-hash in post #3 
              
              
                https://discuss.pytorch.org/t/torchvision-transfors-how-to-perform-identical-transform-on-both-image-and-target/10606 

Read the topic above, and then read some Github issues. Now, I think the best solution is to write own transform(take both image and target as arguments). 
For example, my initial…