前言
现在来介绍一种更快速的视频检测模型,通过前面的一些环境的配置,配置好了opencv等环境。将下面的代码进行改进,就可以得到更快速的视频检测结果了~
1代码
# coding: utf-8
# In[1]:
# By Bend_Function
# https://space.bilibili.com/275177832
# 可以放在任何文件夹下运行(前提正确配置API[环境变量])
# 输出视频没有声音,pr可解决一切
import numpy as np
import os
import sys
import tensorflow as tf
import cv2
import time
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
start = time.time()
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
cv2.setUseOptimized(True) # 加速cv
# This is needed since the notebook is stored in the object_detection folder.
sys.path.append("..")
# 可能要改的内容
######################################################
PATH_TO_CKPT = 'C:\\Machine_learning\\models-master\\research\\object_detection\\zjl_detection\\frozen_inference_graph.pb' # 模型及标签地址
PATH_TO_LABELS = 'C:\\Machine_learning\\models-master\\research\\object_detection\\data\\zjl.pbtxt'
video_