I installed a TensorFlow API (Object Detection) locally using Docker. How can I use this package in a Jupyter Notebook?

I am trying to use Tensorflow’s Object Detection library for a student project. I followed the Tensorflow team’s instructions for installing locally on Docker (See these links: Tensorflow Team’s Instructions and Medium Article with the Same Instructions). I was able to get the image up and running successfully on Docker, i.e. I successfully installed the API.

But I am lacking the background information on Docker to know how and where I can import and use Object Detection functions (ex: from object_detection.utils import label_map_util,from object_detection.utils import dataset_util etc.)

  1. When I try in my local Anaconda Jupyter Notebook, I get a ModuleNotFound Error, presumably because the object_detection API is located in the Docker Container.
  2. I tried using Docker to open a separate Jupyter Notebook by following this article. Here is what I typed into Powershell (command prompt), under the models/research folder:
    $ docker run -p 8888:8888 -v $(pwd):/home/jovyan/work jupyter/minimal-notebook.
    I was able to open a separate Jupyter Notebook using Docker, but this created an entirely separate container from the one with object_detection installed in it. So this also returned a ModuleNotFound error.
  3. I tried to run the same command in a bash shell in the correct container (I used docker exec -it [container_name] /bin/bash). However when I try to enter any ‘docker’ or ‘sudo’ command in that bash shell it returns an error generally saying those commands are not found in the bash shell.

I think I just do not have enough knowledge of Docker to know how and where I am able to import object_detection into my Python code. Any resources, links, or tips will be appreciated.

Source: Docker Questions

LEAVE A COMMENT