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
이미지에 bounding box를 그려서 예측 결과를 눈으로 확인해 볼 수 있도록 만들어 보았습니다.
import numpy as np import pandas as pd import cv2 import os import random import matplotlib.pyplot as plt # class 별 bbox 색 colors = [ (255, 0, 0), (0, 255, 0), (0, 0, 255), (127, 127, 0), (127, 0, 127), (0, 127, 127), (200, 200, 200), (50, 150, 200), (200, 155, 50), (130, 198, 20), ] labels = {0: 'General trash', 1: 'Paper', 2: 'Paper pack', 3: 'Metal', 4: 'Glass', 5: 'Plastic', 6: 'Styrofoam', 7: 'Plastic bag', 8: 'Battery', 9: 'Clothing'} # 이미지 경로 img_dir = './detection/dataset' # output 파일 경로 output_dir = './detection/baseline/faster_rcnn/faster_rcnn_torchvision_epochs_30.csv' test_result = pd.read_csv(output_dir) file_names = test_result['image_id'].values.tolist() bboxes = test_result['PredictionString'].values.tolist() idx = random.choice(range(len(file_names))) file_name = file_names[idx] bbox = bboxes[idx].split() image = cv2.imread(os.path.join(img_dir, file_name)).astype(np.uint8) for i in range(0, len(bbox), 6): label = int(bbox[i]) x_min = int(bbox[i + 2].split('.')[0]) y_min = int(bbox[i + 3].split('.')[0]) x_max = int(bbox[i + 4].split('.')[0]) y_max = int(bbox[i + 5].split('.')[0]) # bounding box 그리기 image = cv2.rectangle(image, pt1=(x_min, y_min), pt2=(x_max, y_max), color=colors[label], thickness=5) # label text 넣기 cv2.putText(image, labels[label], (x_min, y_min - 20), cv2.FONT_HERSHEY_SIMPLEX, 1, colors[label], 3) plt.figure(figsize=(10,10)) plt.imshow(image)
The text was updated successfully, but these errors were encountered:
감사합니다!
Sorry, something went wrong.
EDA에 좋은 자료네요 감사합니다.
No branches or pull requests
이미지에 bounding box를 그려서 예측 결과를 눈으로 확인해 볼 수 있도록 만들어 보았습니다.
코드
예시
The text was updated successfully, but these errors were encountered: