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

[Bug]: AttributeError: 'numpy.ndarray' object has no attribute 'to' #2452

Open
1 task done
Septembit opened this issue Dec 5, 2024 · 0 comments
Open
1 task done

Comments

@Septembit
Copy link

Describe the bug

Seems this bug still exists when I use torch inferencer in anomalib 1.2.0
Do anyone have a way to solve it?
thanks

Dataset

Folder

Model

FastFlow

Steps to reproduce the behavior

N/A

OS information

OS information:

  • OS: [e.g. Ubuntu 20.04]
  • Python version: [e.g. 3.10.0]
  • Anomalib version: [e.g. 0.3.6]
  • PyTorch version: [e.g. 1.9.0]
  • CUDA/cuDNN version: [e.g. 11.1]
  • GPU models and configuration: [e.g. 2x GeForce RTX 3090]
  • Any other relevant information: [e.g. I'm using a custom dataset]

Expected behavior

N/A

Screenshots

No response

Pip/GitHub

pip

What version/branch did you use?

No response

Configuration YAML

N/A

Logs

def pre_process(self, image: np.ndarray) -> torch.Tensor:
        """Pre process the input image.

        Args:
            image (np.ndarray): Input image

        Returns:
            Tensor: pre-processed image.
        """
        if len(image) == 3:
            image = image.unsqueeze(0)

        return image.to(self.device)

Code of Conduct

  • I agree to follow this project's Code of Conduct
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