Skip to content
New issue

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

Inference error #16

Open
atabeyunlu opened this issue Nov 30, 2023 · 0 comments
Open

Inference error #16

atabeyunlu opened this issue Nov 30, 2023 · 0 comments

Comments

@atabeyunlu
Copy link

Hi,

I was trying out the inference file (example_inference.ipynb) you provided but encountered an error at:

res = img2mol(filepath="examples/digital_example1.png", cddd_server=cddd_server) part.

I am copying the error message here. I just followed the installation through the readme and just tried this script with the images you provided.

I think there are some changes in the arguments of the transforms.RandomRotation and transforms.RandomAffine.

----> [1]res = img2mol(filepath="examples/digital_example1.png", cddd_server=cddd_server)

/Img2Mol/img2mol/inference.py:136), in Img2MolInference.__call__(self, filepath, cddd_server, return_cddd)
    131 def __call__(self,
    132              filepath: str,
    133              cddd_server: CDDDRequest = None,
    134              return_cddd: bool = False,
    135              ) -> dict:
--> 136     images = self.read_image_to_tensor(filepath, repeats=50)
    137     with torch.no_grad():
    138         cddd = self.model(images).detach().cpu().numpy()

/Img2Mol/img2mol/inference.py:126), in Img2MolInference.read_image_to_tensor(self, filepath, repeats)
    124     return "Image must be jpg or png format!"
    125 image = self.read_imagefile(filepath)
--> 126 images = torch.cat([torch.unsqueeze(self.transform_image(image), 0)
    127                     for _ in range(repeats)], dim=0)
    128 images = images.to(self.device)
    129 return images

/Img2Mol/img2mol/inference.py:126), in <listcomp>(.0)
    124     return "Image must be jpg or png format!"
...
--> 107     img_PIL = transforms.RandomRotation((-15, 15), resample=3, expand=True, center=None, fill=255)(image)
    108     img_PIL = transforms.ColorJitter(brightness=[0.75, 2.0], contrast=0, saturation=0, hue=0)(img_PIL)
    109     shear_value = np.random.uniform(0.1, 7.0)

TypeError: RandomRotation.__init__() got an unexpected keyword argument 'resample'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant