Open zhouyaqian666 opened 2 years ago
The main code can be shown by
diversity = torch.unique(torch.argmax(outputs_target,dim=1)).shape[0]/ torch.unique(labels_target).shape[0]
where labels_target denotes the ground truth of labels, and outputs_target denotes the prediction outputs.
Details can be refer to train_image.py
In unsupervised domain adaptation,the "labels_target" is usually unknown, how do you get the "labels_target"? Where should this line of code be placed in the train_image.py? Can you explain it in detail? Thank you very much.
inputs_target, labels_target= iter_target.next()
Then we can add the calculation diversity before line 173
Finally, we can print the diversity to see the variation.
Hello, the diversity ratio is measured by the mean predicted category number dividing the mean ground-truth category number. Is there a code to calculate the diversity ratio? Thanks.