-
Notifications
You must be signed in to change notification settings - Fork 329
/
Copy pathdetection_demo.py
31 lines (27 loc) · 1.05 KB
/
detection_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#================================================================
# Copyright (C) 2020 * Ltd. All rights reserved.
#
# File name : detection_demo.py
# Author : PyLessons
# Created date: 2020-04-20
# Website : https://pylessons.com/
# GitHub :
# Description : object detection example
#
#================================================================
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import cv2
import numpy as np
import tensorflow as tf
from yolov3.yolov3 import Create_Yolov3
from yolov3.utils import load_yolo_weights, detect_image, detect_video
from yolov3.configs import *
input_size = YOLO_INPUT_SIZE
Darknet_weights = YOLO_DARKNET_WEIGHTS
image_path = "./IMAGES/kite.jpg"
video_path = "./IMAGES/street_drive.mp4"
yolo = Create_Yolov3(input_size=input_size)
load_yolo_weights(yolo, Darknet_weights) # use Darknet weights
detect_image(yolo, image_path, '', input_size=input_size, show=True, rectangle_colors=(255,0,0))
#detect_video(yolo, video_path, '', input_size=input_size, show=True, rectangle_colors=(255,0,0))