Closed stphtan94117 closed 1 year ago
Currently there's no direct method to use custom weights. We'll add this support in next update
another question: is it possible to detect on RTSP? want to detect in real-time on cctv. thanks.
Not at the moment, we'll add these in next updates. The update allowing users to use custom weights will hopefully be over weekend. The RTSP and similar protocols will be dealt in next update
please add the custom weights option asap
This feature has been added in new updates. Here's how to add custom weights
import asone
from asone import utils
from asone import ASOne
import cv2
video_path = 'data/sample_videos/license_video.webm'
detector = ASOne(detector=asone.YOLOV7_PYTORCH, weights='data/custom_weights/yolov7_custom.pt', use_cuda=True) # Set use_cuda to False for cpu
class_names = ['license_plate'] # your custom classes list
cap = cv2.VideoCapture(video_path)
while True:
_, frame = cap.read()
if not _:
break
dets, img_info = detector.detect(frame)
bbox_xyxy = dets[:, :4]
scores = dets[:, 4]
class_ids = dets[:, 5]
frame = utils.draw_boxes(frame, bbox_xyxy, class_ids=class_ids, class_names=class_names) # simply pass custom classes list to write your classes on result video
cv2.imshow('result', frame)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
I train a model for pigs and other animals. (yolov5x) so how to use my weight pt file to this model? i want to track and counting function.
thanks