ModuleNotFoundError: нет модуля с именем tf_slim - PullRequest
1 голос
/ 20 июня 2020

Использование Anaconda, чтобы попытаться настроить deeplab (https://github.com/tensorflow/models/tree/master/research/deeplab).

Я справился с множеством проблем, увидев ответы на другие вопросы, но нашел тот, который не кажется необходимо ответить:

при попытке запустить «python deeplab / model_test.py» я получаю:

(base) PS D:\DeepLab\models-master\research> python deeplab/model_test.py
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
  File "deeplab/model_test.py", line 22, in <module>
    from deeplab import model
  File "D:\DeepLab\models-master\research\deeplab\model.py", line 58, in <module>
    from deeplab.core import feature_extractor
  File "D:\DeepLab\models-master\research\deeplab\core\feature_extractor.py", line 24, in <module>
    from deeplab.core import nas_network
  File "D:\DeepLab\models-master\research\deeplab\core\nas_network.py", line 44, in <module>
    from deeplab.core import nas_genotypes
  File "D:\DeepLab\models-master\research\deeplab\core\nas_genotypes.py", line 23, in <module>
    from deeplab.core import nas_cell
  File "D:\DeepLab\models-master\research\deeplab\core\nas_cell.py", line 29, in <module>
    from deeplab.core import xception as xception_utils
  File "D:\DeepLab\models-master\research\deeplab\core\xception.py", line 58, in <module>
    from nets.mobilenet import conv_blocks as mobilenet_v3_ops

  **File "D:\DeepLab\models-master\research\slim\nets\mobilenet\conv_blocks.py", line 20, in <module>
    import tf_slim as slim
ModuleNotFoundError: No module named 'tf_slim'**

Я нашел несколько предположений, что это может быть связано с переменной среды, но моя все верны: env vars , и я несколько раз обновил окно anaconda, чтобы убедиться, что изменения происходят.

У меня есть tf_slim в моей папке: C: \ Program Files \ Python36 \ Lib \ site-packages \ tf_slim.

Не уверен, что делать :( Я новичок в этом типе установки.

Я использую windows 10.

Ответы [ 2 ]

1 голос
/ 20 июня 2020

Anaconda по умолчанию создает виртуальную среду, и если вы откроете python через приглашение anaconda, откроется исполняемый файл python в виртуальной среде. Эта виртуальная среда будет иметь собственный набор модулей и не будет относиться к пакетам системного уровня python. Я предлагаю вам открыть приглашение anaconda и ввести следующую команду:

pip install tf_slim

0 голосов
/ 01 сентября 2020

Попробуйте запустить

Export PYTHONPATH=$PYTHONPATH:’pwd’:’pwd’/slim
...