Hi guys I'm having an error when I'm trying to run the training using this command:
> `python train.py --logtostderr --train_dir=training/
> --pipeline_config_path=training/ssd_mobilenet_v1_coco.config`
Traceback (most recent call last): File "train.py", line 51, in
<module> from object_detection.builders import model_builder File
"C:\tensorflow1\models\research\object_detection\builders\model_builder.py",
line 35, in <module> from object_detection.models import
faster_rcnn_inception_resnet_v2_feature_extractor as frcnn_inc_res
File
"C:\tensorflow1\models\research\object_detection\models \faster_rcnn_inception_resnet_v2_feature_extractor.py",
line 28, in <module> from nets import inception_resnet_v2
ModuleNotFoundError: No module named 'nets
The nets module is in slim folder, you need to add the slim library to PYTHONPATH:
# From tensorflow/models/research/
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
Try Installing pip install nets and also check the site package and environment package for installed folders (It worked for me)
Related
I've installed DBT CLI on GCP cloud shell using pip install dbt after that I had added the path to dbt in my .profile file too -
.profile file -
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$HOME/.local/lib/python3.9/site-packages:$PATH"
fi
export $PATH
After the above steps, now when I test the commands like - dbt --version it gives below error -
my_name#cloudshell:~$ dbt --init
Traceback (most recent call last):
File "/home/my_name/.local/bin/dbt", line 5, in <module>
from dbt.main import main
File "/home/my_name/.local/lib/python3.9/site-packages/dbt/main.py", line 11, in <module>
import dbt.version
File "/home/my_name/.local/lib/python3.9/site-packages/dbt/version.py", line 11, in <module>
import dbt.semver
File "/home/my_name/.local/lib/python3.9/site-packages/dbt/semver.py", line 8, in <module>
import dbt.utils
File "/home/my_name/.local/lib/python3.9/site-packages/dbt/utils.py", line 9, in <module>
import jinja2
File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/__init__.py", line 12, in <module>
from .environment import Environment
File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/environment.py", line 25, in <module>
from .defaults import BLOCK_END_STRING
File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/defaults.py", line 3, in <module>
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/filters.py", line 13, in <module>
from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.9/dist-packages/markupsafe/__init__.py)
Where have I failed? Can anyone please correct me?
Try pip install dbt-[adapter] (eg dbt-bigquery) which will install the latest version of dbt, rather than the pre-1.0 version you’re getting now (which has become broken due to an issue with a dependency).
Im working with gcloud and I got this error:
The replica master 0 exited with a non-zero status of 1.
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/conda/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/.local/lib/python3.7/site-packages/object_detection/model_main.py", line 25, in <module>
from object_detection import model_lib
File "/root/.local/lib/python3.7/site-packages/object_detection/model_lib.py", line 30, in <module>
from object_detection import exporter as exporter_lib
File "/root/.local/lib/python3.7/site-packages/object_detection/exporter.py", line 24, in <module>
from object_detection.builders import model_builder
File "/root/.local/lib/python3.7/site-packages/object_detection/builders/model_builder.py", line 37, in <module>
from object_detection.meta_architectures import deepmac_meta_arch
File "/root/.local/lib/python3.7/site-packages/object_detection/meta_architectures/deepmac_meta_arch.py", line 19, in <module>
from object_detection.models.keras_models import resnet_v1
File "/root/.local/lib/python3.7/site-packages/object_detection/models/keras_models/resnet_v1.py", line 22, in <module>
from tensorflow.python.keras.applications import resnet
ModuleNotFoundError: No module named 'tensorflow.python.keras.applications'
My requeriments.txt file is:
six
google-api-python-client>=1.6.7
kaggle>=1.3.9
Keras-Applications
numpy>=1.15.4
oauth2client
pandas>=0.22.0
psutil>=5.4.3
py-cpuinfo>=3.3.0
scipy>=0.19.1
tensorflow-hub>=0.6.0
tensorflow-model-optimization
tensorflow-model-optimization>=0.4.1
tensorflow-addons
dataclasses;python_version<"3.7"
gin-config
tf_slim>=1.1.0
Cython
matplotlib
# Loader becomes a required positional argument in 6.0 in yaml.load
pyyaml>=5.1,<6.0
# CV related dependencies
opencv-python-headless
Pillow
pycocotools
# NLP related dependencies
seqeval
sentencepiece
sacrebleu
From my terminal I used this code to run the machine learning:
gcloud ai-platform jobs submit training segmentation_maskrcnn_img_53 ^
--runtime-version 2.5 ^
--python-version 3.7 ^
--job-dir=gs://meat-segmentation-img/training_process ^
--package-path ./object_detection ^
--module-name object_detection.model_main ^
--region us-central1 ^
--scale-tier CUSTOM ^
--master-machine-type n1-standard-16 ^
--master-accelerator count=1,type=nvidia-tesla-t4 ^
-- ^
--model_dir=gs://meat-segmentation-img/training_process ^
--pipeline_config_path=gs://meat-segmentation-img/mask_rcnn_inception_resnet_v2_1024x1024_coco17_gpu-8.config
I used runtime version 2.7 but I got this error:
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /opt/conda/lib/python3.7/site-packages/scipy/optimize/_group_columns.cpython-37m-x86_64-linux-gnu.so)
How I fix this?
I'm using this from Windows by conda environment.
You may need to modify the code for importing keras applications as
from tensorflow.keras import applications
in place of
from tensorflow.python.keras import applications.
Please check this link for more details.
I am currently using the Google core dev board and using Putty to enter the code.
While performing the code, I got the error as below.
Traceback (most recent call last):
File "tools/generate_detections.py", line 7, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
So I typed sudo pip install tensorflow.
but I got another error as below.
Traceback (most recent call last):
File "/home/mendel/.local/bin/pip", line 6, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/configuration.py", line 27, in <module>
from pip._internal.utils.misc import ensure_dir, enum
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/misc.py", line 42, in <module>
from pip._internal.locations import get_major_minor_version, site_packages, user_site
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/locations/__init__.py", line 14, in <module>
from . import _distutils, _sysconfig
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/locations/_distutils.py", line 9, in <module>
from distutils.cmd import Command as DistutilsCommand
ModuleNotFoundError: No module named 'distutils.cmd'
So I typed sudo apt install python3-distutils.
but I got another error as below.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3-distutils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libpython3.7-stdlib
E: Package 'python3-distutils' has no installation candidate
I can no longer find a solution.
Is there anyone who can help me?
sudo apt install python3-distutils
Just install in your Ubuntu terminal after you can install other packages!
In the pull requests, I see that master branch has code which works with TF2. I am looking into how to use them.
I use a conda env with python 3.7.7 and tf 2.2. Then I pulled master branch from gihub celverhans. But, when I try to run mnist_tutorial_tfe.py, I get the following error.
$ python ./cleverhans_tutorials/mnist_tutorial_tfe.py
Traceback (most recent call last):
File "./cleverhans_tutorials/mnist_tutorial_tfe.py", line 23, in <module>
from cleverhans.utils_tfe import train, model_eval
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/utils_tfe.py", line 17, in <module>
from cleverhans.loss import LossCrossEntropy
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/loss.py", line 10, in <module>
from cleverhans.attacks import Attack
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/attacks/__init__.py", line 12, in <module>
from cleverhans.attacks.attack import Attack
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/attacks/attack.py", line 13, in <module>
from cleverhans.model import Model
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/model.py", line 9, in <module>
from cleverhans import utils_tf
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/utils_tf.py", line 345, in <module>
loss_collection=tf.GraphKeys.REGULARIZATION_LOSSES):
AttributeError: module 'tensorflow' has no attribute 'GraphKeys'
How can I use cleverhans with TF2? It seems the relevant code is under cleverhans/future directory. But how to make these official examples run under TF2?
I installed TensorFlow Datasets using conda, as:
conda install -c anaconda tensorflow-datasets
I've tried importing Cityscapes:
from tensorflow_datasets.image.cityscapes import Cityscapes
but this raises the following error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'tensorflow_datasets.image.cityscapes'
How can I fix it?
PS: I can import the following without errors:
import tensorflow_datasets as tfds
Edit:
I've already downloaded Cityscapes data, as recommended in the official guide.