在Colab中运行imageAI时找不到resnet50_coco_best_v2.0.1.h5

时间:2019-02-24 07:37:54

标签: python tensorflow google-colaboratory

我正在尝试检测棒球视频中的一些物体。我在Google colab中使用ImageAI。在本地计算机(Anaconda)上一切正常。我想在colab GPU中运行它。我有一个Google文件夹“ sneha”,其中有我的balloon.ipynb,resnet50_coco_best_v2.0.1.h5和balloon.mp4。我已经在colab中安装了imageAI,并将运行时也更改为GPU。我还使用以下代码将其安装到我的Google驱动器上:-

from google.colab import drive
drive.mount('/content/drive/') 

你们能告诉我如何从驱动器文件夹中导入“ resnet”。下面是我的imageAI对象检测代码:-

from imageai.Detection import VideoObjectDetection
import os

execution_path = os.getcwd()

detector = VideoObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()

custom_objects = detector.CustomObjects(person=True, traffic_light=True, stop_sign=True, sports_ball=True, baseball_bat=True, baseball_glove=True)

video_path = detector.detectCustomObjectsFromVideo(custom_objects=custom_objects, input_file_path=os.path.join(execution_path, "baseball.mp4"),
                                output_file_path=os.path.join(execution_path, "traffic_custom_detected")
                                , frames_per_second=20, log_progress=True)
print(video_path)

先谢谢大家

0 个答案:

没有答案