Python 如何将ssd_mobilenet_v1_COCO_2017_11_17本地加载到对象检测网络摄像头?
每次运行object_detection_webcam.py时,这段代码基本上都会下载ssd_mobilenet_v1_COCO_2017_11_17模型 如何在每次运行脚本时不必下载ssd_mobilenet_v1_COCO_2017_11_17就可以运行同一个文件? 我对使用.tar文件非常陌生 您的帮助将不胜感激请添加一项检查,查看是否有,如果有,请不要下载Python 如何将ssd_mobilenet_v1_COCO_2017_11_17本地加载到对象检测网络摄像头?,python,tensorflow,object-detection,object-detection-api,Python,Tensorflow,Object Detection,Object Detection Api,每次运行object_detection_webcam.py时,这段代码基本上都会下载ssd_mobilenet_v1_COCO_2017_11_17模型 如何在每次运行脚本时不必下载ssd_mobilenet_v1_COCO_2017_11_17就可以运行同一个文件? 我对使用.tar文件非常陌生 您的帮助将不胜感激请添加一项检查,查看是否有,如果有,请不要下载 MODEL_FILE = MODEL_NAME + '.tar.gz' DOWNLOAD_BASE = 'http://downlo
MODEL_FILE = MODEL_NAME + '.tar.gz'
DOWNLOAD_BASE = 'http://download.tensorflow.org/models/object_detection/'
# Path to frozen detection graph.
PATH_TO_CKPT = MODEL_NAME + '/frozen_inference_graph.pb'
# List of the strings that is used to add correct label for each box.
PATH_TO_LABELS = os.path.join('data', 'mscoco_label_map.pbtxt')
NUM_CLASSES = 90
#Download Model
# you can manually download this
opener = urllib.request.URLopener()
opener.retrieve(DOWNLOAD_BASE + MODEL_FILE, MODEL_FILE)
tar_file = tarfile.open(MODEL_FILE)
for file in tar_file.getmembers():
file_name = os.path.basename(file.name)
if 'frozen_inference_graph.pb' in file_name:
tar_file.extract(file, os.getcwd())
if not os.path.isfile(MODEL_FILE):
# Code to download and extract goes here