Answer the question
In order to leave comments, you need to log in
How to remake code for colab?
Hello.
I wrote a little code for object detection. But since it didn't work on my PC, I ran it in colab.
The code:
import os
from imageai.Detection import ObjectDetection
exec_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(
exec_path, "resnet50_coco_best_v2.1.0.h5")
)
detector.loadModel()
list = detector.detectObjectsFromImage(
input_image=os.path.join(exec_path, "face.jpg"),
output_image_path=os.path.join(exec_path, "new_objects.jpg")
)
NameError Traceback (most recent call last)
<ipython-input-1-fea08fe8a5c2> in <module>()
2
3
----> 4 exec_path = os.getcwd()
5
6 detector = ObjectDetection()
NameError: name 'os' is not defined
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question