V7 vs V8 comparison
This is a comparison video between yolo v7 and v8.
Here is information for each version
Yolo V7
- Github : https://github.com/WongKinYiu/yolov7
- Model : yolov7x.pt
Yolo V8
- Github : https://github.com/ultralytics/ultralytics
- Model : yolov8x.pt
Testing Computer :
- Intel(R) Core(TM) i7-9800X CPU @ 3.80GHz
- RTX 4090
Something might be useful code
- yolo v8, video writer for detection result
import cv2import timefrom ultralytics import YOLO
def process_video(model, video_path, output_path): cap = cv2.VideoCapture(video_path) width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) fps = int(cap.get(cv2.CAP_PROP_FPS))
# Create a VideoWriter object to save the annotated video fourcc = cv2.VideoWriter_fourcc(*'mp4v') out = cv2.VideoWriter(output_path, fourcc, fps, (width, height))
while cap.isOpened(): success, frame = cap.read()
if success: start_time = time.time() results = model(frame) end_time = time.time() processing_time = end_time - start_time fps = 1/processing_time # Visualize the results on the frame annotated_frame = results[0].plot() # Display the processing time on the annotated frame cv2.putText(annotated_frame, f"Processing time: {processing_time:.4f} seconds / {fps:.4f} fps", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
# Write the annotated frame to the output video out.write(annotated_frame)
# cv2.imshow("YOLOv8 Inference", annotated_frame) # if cv2.waitKey(1) & 0xFF == ord("q"): # break else: break
cap.release() out.release()
def main(): # Load the YOLO model model = YOLO('yolov8x.pt')
# List of video files video_paths = [ "../video/videoplayback-1.mp4", "../video/videoplayback-2.mp4", "../video/videoplayback-3.mp4", "../video/videoplayback-4.mp4", ]
# Loop through video files and process them for i, video_path in enumerate(video_paths): output_path = f"../video/yolo_88_output_{i+1}.mp4" process_video(model, video_path, output_path)
cv2.destroyAllWindows()
if __name__ == '__main__': main()
- make 2 video to side by side
Combine Two Videos Side by Side with OpenCV python
Thank you! ๐บ
No comments:
Post a Comment