深度学习|yolov5之可视化特征图和检测结果

【深度学习|yolov5之可视化特征图和检测结果】(1)对640*480*3的狗图进行检测和特征可视化
这个模型使用的是6.1版本的yolov5s.pt,狗图我放在百度云盘了,链接为:
链接:https://pan.baidu.com/s/1uPNK40bYCxHqIkd5LfMcuA
提取码:lf0h

import warningswarnings.filterwarnings('ignore') warnings.simplefilter('ignore') import torch import torch.nn as nn import cv2 import numpy as np import requests import torchvision.transforms as transforms from pytorch_grad_cam import EigenCAM from pytorch_grad_cam.utils.image import show_cam_on_image, scale_cam_image from PIL import ImageCOLORS = np.random.uniform(0, 255, size=(80, 3))def parse_detections(results): detections = results.pandas().xyxy[0] detections = detections.to_dict() boxes, colors, names = [], [], []for i in range(len(detections["xmin"])): confidence = detections["confidence"][i] if confidence < 0.2: continue

    推荐阅读