Untitled
plain_text
15 days ago
1.0 kB
0
Indexable
Never
#clone YOLOv5 and !git clone https://github.com/ultralytics/yolov5 # clone repo %cd yolov5 %pip install -qr requirements.txt # install dependencies %pip install -q roboflow import torch import os from IPython.display import Image, clear_output # to display images print(f"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_properties(0).name if torch.cuda.is_available() else 'CPU'})") !python train.py --img 640 --batch 16 --epochs 30 --data /content/data.yaml --weights yolov5s.pt --cache !python detect.py --weights runs/train/exp/weights/best.pt --img 540 --conf 0.1 --source /content/VOC2005_1/test/images #display inference on ALL test images import glob from IPython.display import Image, display for imageName in glob.glob('/content/yolov5/runs/detect/exp/*.jpg'): #assuming JPG display(Image(filename=imageName)) print("\n") !python export.py --imgsz 640 640 --weights /content/yolov5/runs/train/exp/weights/best.pt --simplify --data /content/data.yaml --include onnx