Object detection on Image/Video using Yolo v5
Github: repository
Clone git
!git clone https://github.com/ultralytics/yolov5.git
Change Directory
%cd yolov5/
!pip install -U -r requirements.txt
!python detect.py --source ./inference/images/zidane.jpeg --weights
yolov5s.pt --conf 0.4
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
image = cv2.imread("/content/yolov5/runs/detect/exp/indianmarket.jpg")
height, width = image.shape[:2]
resized_image = cv2.resize(image,(3*width, 3*height), interpolation = cv2.INTER_CUBIC)
fig = plt.gcf()
fig.set_size_inches(18, 10)
plt.axis("off")
plt.imshow(cv2.cvtColor(resized_image, cv2.COLOR_BGR2RGB))
plt.show()
!python detect.py --source inference/images/local.mp4 --weights
yolov5s.pt --conf 0.4

where to use it]
ReplyDeleteyou can use it on google colab
ReplyDeleteMake sure you read documentation
ReplyDelete