1

I am just starting with TensorFlow and came across the TensorFlow Object Detection API tutorial. I have followed the installation steps outlined in the first section, created a new conda virtual environment (within Visual Studio 2017) and installed TensorFlow using pip. Also I have installed the packages listed in the other sections.

This are the imports taken from here: Detect Objects Using Your Webcam

import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
import cv2

from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
from utils import label_map_util
from utils import visualization_utils as vis_util

However it can't find the a package/module called utils. Unsurprisingly trying to import it fails with:

>>> from utils import label_map_util
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'utils'

So what kind of module is this and where can I get it from?

2 Answers 2

1

Add the root directory of Object Detection API ( ...\models\research\object_detection ) to PYTHONPATH by:

export PYTHONPATH=\path\to\models\research\object_detection\:$PYTHONPATH

Sign up to request clarification or add additional context in comments.

Comments

1

You can also install the object detection api into your python/conda environment using

python setup.py build
python setup.py install

This will make sure that your conda environment finds the packages automatically. The setup.py file is in the models/research folder.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.