赞
踩
yolov5 github:https://github.com/ultralytics/yolov5
跟踪:https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch
TensorRT:https://github.com/TrojanXu/yolov5-tensorrt
NCNN:https://github.com/WZTENG/YOLOv5_NCNN
detect:
- from torchvision import transforms
- import torch
- from PIL import Image,ImageDraw
- from models import yolo
- from utils.general import non_max_suppression
- from models.experimental import attempt_load
-
- # model = yolo.Model(r"D:\GoogleEarthProPortable\yolov5-master\models\yolov5s.yaml")
- # model.load_state_dict(torch.load(r"D:\GoogleEarthProPortable\yolov5-master\weights\yolov5s.pt"))
- model = attempt_load("weights/yolov5s.pt") # load FP32 model
- model.eval()
-
- img = Image.open("inference/images/bus.jpg")
-
- tf = transforms.Compose([
- transforms.Resize((512,640)),
- transforms.ToTensor()
- ])
-
- print(img.size) # w,h
- scale_w = img.size[0] /640
- scale_h = img
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。