在 colab 中使用 ssd_inceptionv2 时遇到问题错误 import tf_slim as slim ModuleNotFoundError: No module named 'tf_slim'

问题描述

我在 colab 中使用 ModuleNotFoundError 时有一个 ssd_inceprionv2

ModuleNotFoundError: No module named 'tf_slim'

这是我目前所做的:

%cd /content
!git clone --quiet https://github.com/tensorflow/models.git

!apt-get install -qq protobuf-compiler python-pil python-lxml python-tk

!pip install -q Cython contextlib2 pillow lxml matplotlib

!pip install -q pycocotools

%cd /content/models/research
!protoc object_detection/protos/*.proto --python_out=.
import os
os.environ['PYTHONPATH'] += ':/content/models/research/:/content/models/research/slim/'

!python object_detection/builders/model_builder_test.py

解决方法

Colab 上似乎没有安装 tf_slim。 手动安装tf_slim

!pip install tf_slim