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
Hello, very interesting package.
Can someone provide a code snipped for a "Add implementation for len and getitem methods in dataset.py."
My dataset is a classification problem, and the files are structured like
Project/group1/*bmp Project/group2/*bmp
Thank you
Andreas
The text was updated successfully, but these errors were encountered:
The following dataset.py is working for me:
import torch.utils.data import torchvision from torchvision import dataset import cv2 cv2.setNumThreads(0)
import torch.utils.data
import torchvision
from torchvision import dataset
import cv2
cv2.setNumThreads(0)
dataset = datasets.ImageFolder("/Project/") images = dataset.imgs
dataset = datasets.ImageFolder("/Project/")
images = dataset.imgs
class SearchDataset(torch.utils.data.Dataset):
def __init__(self, images_filepaths=images, transform=None): self.images_filepaths = images_filepaths self.transform = transform def __len__(self): return len(self.images_filepaths) def __getitem__(self, index): path, label = self.images_filepaths[index] image = cv2.imread(path) image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) if self.transform is not None: transformed = self.transform(image=image) image = transformed["image"] return image, label
Images should be all of the same size. If they are not, you can resize them by adding to __getitem__: image = cv2.resize(image, (height, width))
__getitem__
image = cv2.resize(image, (height, width))
Sorry, something went wrong.
No branches or pull requests
Hello,
very interesting package.
Can someone provide a code snipped for a
"Add implementation for len and getitem methods in dataset.py."
My dataset is a classification problem, and the files are structured
like
Project/group1/*bmp
Project/group2/*bmp
Thank you
Andreas
The text was updated successfully, but these errors were encountered: