Closed shuyanzhou closed 3 years ago
@shuyanzhou, have you tried normalizing the image tensor before passing it to the ResNet? See this.
Also, make sure to use ResNet with eval
mode. Otherwise the batch-norm layers will mess up the output
Ooops sorry, you are using the same function
Double check that it's in eval
mode. It could also be the PNG->JPG w/ compression conversion that's causing minor differences. Originally, we saved PNG files, but these were later converted to JPGs to save space.
I am using the models.utils.extract_resnet.py and simply add
x = Image.open("full_2.1.0/train/pick_and_place_with_movable_recep-ButterKnife-Cup-SinkBasin-2/trial_T20190908_233322_447979/raw_images/000000000.jpg")
feat = extractor.featurize([x], batch=1)
print(feat[0][:5,:5])
The eval model is set True in the code originally.
I tried both jpg and png (by simply change the name), but they give the same result
I found the original PNG, can you try it with this:
I also wonder if it's somehow related to this issue: https://github.com/askforalfred/alfred/issues/27#issuecomment-637436775
It might be that the pre-trained ResNet model from torchvision somehow changed recently.
Awesome, it is due to the different file formats. The results are consistent now. BTW, would it be convenient for you to give me all the images of the png format for this example? Or is there a way I can get it by myself? Thanks!
Well the dataset with raw PNG files was 2-3x bigger than the one with JPGs. So we couldn't figure out a proper way of hosting it.
The faster fix is to just run extract_resnet.py
on your local PNGs and then re-train the model with those features.
I noticed a difference in feature vectors produced by pytorch resnet when run on a gpu vs cpu. The difference is non-negligible, in the 1e-2 range. Perhaps this is related to the reproducibility issues reported in many threads.
wow very strange.
Hi,
I am doing this example: full_2.1.0/train/pick_and_place_with_movable_recep-ButterKnife-Cup-SinkBasin-2/trial_T20190908_233322_447979/raw_images
For image 000000000.jpg
I get
When using
I get