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

yolov5 model while trying to create a confusion matrix, I encountered an issue. Please help. #5173

Closed
asdfzxcvasdfdsaf opened this issue Dec 6, 2023 · 2 comments
Labels
invalid/unrelated unrelated to this project or invalid type of issues needs-more-info More info is needed to complete the issue

Comments

@asdfzxcvasdfdsaf
Copy link

code :
import torch
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import ImageFolder
from sklearn.metrics import confusion_matrix, classification_report
import numpy as np
from tqdm import tqdm
from PIL import Image

data_dir = "/content/testdataset"

transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
])

dataset = ImageFolder(data_dir, transform=transform)
dataloader = DataLoader(dataset, batch_size=32, shuffle=False)
print(dataset)

output :
Dataset ImageFolder
Number of datapoints: 1491
Root location: /content/testdataset
StandardTransform
Transform: Compose(
Resize(size=(224, 224), interpolation=bilinear, max_size=None, antialias=warn)
ToTensor()
)

I was fine until now, but I'm encountering issues from this point onward.

code :
model.eval()

all_predictions = []
all_labels = []

for inputs, labels in tqdm(dataloader, desc="Evaluating"):
# 모델 예측 수행
with torch.no_grad():
outputs = model(inputs)

----> 8 for inputs, labels in tqdm(dataloader, desc="Evaluating"):
UnidentifiedImageError: cannot identify image file <_io.BufferedReader name='/content/testdataset/with_mask/1 (371).jpeg'>

@github-actions github-actions bot added the needs-more-info More info is needed to complete the issue label Dec 6, 2023
Copy link

github-actions bot commented Dec 6, 2023

You've chosen to report an unexpected problem or bug. Unless you already know the root cause of it, please include details about it by filling the issue template.
The following information is missing: "Instructions To Reproduce the Issue and Full Logs"; "Your Environment";

Copy link

Requested information was not provided in 7 days, so we're closing this issue.

Please open new issue if information becomes available. Otherwise, use github discussions for free-form discussions.

@github-actions github-actions bot added the invalid/unrelated unrelated to this project or invalid type of issues label Dec 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid/unrelated unrelated to this project or invalid type of issues needs-more-info More info is needed to complete the issue
Projects
None yet
Development

No branches or pull requests

1 participant