We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
thanks for you work. I test pair image by the model:imagenet_64bit_0.8734_resnet50.pkl. and get the hamming distance:0 This is my test code:
class CSQ(object): def __init__(self): self.model_path = 'checkpoint/imagenet_64bit_0.8734_resnet50.pkl' self.device = "cuda" if torch.cuda.is_available() else "cpu" self.transform = prep.image_test(resize_size=255, crop_size=224) self.load_model() def load_model(self, ): self.model = torch.load(self.model_path) self.model = self.model.module self.model.to(device=self.device) self.model.eval() def forward(self, img_path): tensor_img = self.transform(Image.open(img_path).convert('RGB')).unsqueeze(0).to(self.device) with torch.no_grad(): out = self.model(tensor_img) hash_code = out.cpu().numpy() hash_code[hash_code < 0] = -1 hash_code[hash_code >= 0] = 1 code_list = ''.join(['1' if item == 1.0 else '0' for item in hash_code[0].tolist()]) return code_list
The text was updated successfully, but these errors were encountered:
No branches or pull requests
thanks for you work. I test pair image by the model:imagenet_64bit_0.8734_resnet50.pkl. and get the hamming distance:0
This is my test code:
The text was updated successfully, but these errors were encountered: