tjddus9597 / LabelRelaxation-CVPR21

Official PyTorch Implementation of Embedding Transfer with Label Relaxation for Improved Metric Learning, CVPR 2021
MIT License
41 stars 6 forks source link

problems of transformation function #1

Closed JeffersonXie closed 3 years ago

JeffersonXie commented 3 years ago

Hi, my friend. Thanks for opening your valuable research work. I have a small question about the class Multitransforms contained in the dataset/utils.py. Specifically, it is about the argument "is_train". When a value of "false" is assigned to this argument, the transformation function is designed for obtaining the evaluation set. However, in practice, you did not follow the common practice, i.e., cropping the test image with a size of 224*224 and using it as the input to the network. Instead, you just fed the original image into to model. Can you explain why did you do like that?

tjddus9597 commented 3 years ago

Thanks for your interest in my work! In the code, "dataset.utils.make_transform" is used for evaluation set. As shown in the code, if "is_train" is "False", "Resize" and "CenterCrop" are applied instead of "RandomResizedCrop" and "RandomHorizontalFlip". inception_transform = transforms.Compose( [ RGBToBGR(), transforms.RandomResizedCrop(inception_sz_crop) if is_train else Identity(), transforms.RandomHorizontalFlip() if is_train else Identity(), transforms.Resize(inception_sz_resize) if not is_train else Identity(), transforms.CenterCrop(inception_sz_crop) if not is_train else Identity(), transforms.ToTensor(), ScaleIntensities([0, 1], [0, 255]), transforms.Normalize(mean=inception_mean, std=inception_std) ])

Note that "Resize" and "CenterCrop" are constrained by if not is_train else Identity() .

In summary, we use resize and center crop for augmentation of the evaluation set, as in the common evaluation protocol. Please check the code again, and let me know if there are any bugs. Thank you!

JeffersonXie commented 3 years ago

Ok. Thanks for your patient explanation. I missed the "not" in front of the "is_train".