I am following this tutorial: https://pythonprogramming.net/introduction-use-tensorflow-object-detection-api-tutorial/ to do object detection on my own dataset and finetune the pre-trained model.
when I run this command:
python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
I get this error:
Traceback (most recent call last):
File "train.py", line 51, in <module>
from object_detection import trainer
File "/Users/apple/Downloads/models/research/object_detection/trainer.py", line 27, in <module>
from object_detection.builders import preprocessor_builder
File "/Users/apple/Downloads/models/research/object_detection/builders/preprocessor_builder.py", line 21, in <module>
from object_detection.protos import preprocessor_pb2
File
"/Users/apple/Downloads/models/research/object_detection/protos/preprocessor_pb2.py", line 71, in <module>
options=None, file=DESCRIPTOR),
TypeError: __init__() got an unexpected keyword argument 'file'
and removing this argument does not solve this issue.
I am using macosx 10.12.6 - sierra
Any help?
Related
I installed tensorflow gpu one day ago at that time it was working fine, but now when I am trying to launch the notebook i am getting following error.
Traceback (most recent call last):
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\notebook\notebookapp.py", line 80, in <module>
from .services.contents.manager import ContentsManager
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\nbformat\__init__.py", line 32, in <module>
from .validator import validate, ValidationError
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\nbformat\validator.py", line 12, in <module>
from .json_compat import get_current_validator, ValidationError
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\nbformat\json_compat.py", line 10, in <module>
import jsonschema
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\jsonschema\__init__.py", line 14, in <module>
from jsonschema._format import (
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\jsonschema\_format.py", line 240, in <module>
#_checks_drafts(draft7="idn-hostname", raises=idna.IDNAError)
AttributeError: module 'idna' has no attribute 'IDNAError'
A very, very basic solution - but what fixed this a while back for me was pip install idna. Give it a shot.
I use python 3.8.6 and I have loaded Keras 2.2.2, TensorFlow-GPU 2.2.0.
When I run my code, I have this error:
Using TensorFlow backend.
Traceback (most recent call last):
File "XX.py", line 23, in <module>
import keras
File ".local/lib/python3.8/site-packages/keras/__init__.py", line 5, in <module>
from . import applications
File ".local/lib/python3.8/site-packages/keras/applications/__init__.py", line 11, in <module>
import keras_applications
File ".local/lib/python3.8/site-packages/keras_applications/__init__.py", line 8, in <module>
from keras_applications import vgg16
File ".local/lib/python3.8/site-packages/keras_applications/vgg16.py", line 15, in <module>
from . import get_keras_submodule
ImportError: cannot import name 'get_keras_submodule' from partially initialized module 'keras_applications' (most likely due to a circular import) (/local/lib/python3.8/site-packages/keras_applications/__init__.py)
How to solve this error other than downgrade the TensorFlow version?
Thanks!
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?
train.py
Traceback (most recent call last):
File "object_detection/legacy/train.py", line 48, in <module>
from tensorflow.contrib import framework as contrib_framework
ModuleNotFoundError: No module named 'tensorflow.contrib'
module_main.py
Traceback (most recent call last):
File "object_detection/model_main.py", line 26, in <module>
from object_detection import model_lib
File "/content/models/research/object_detection/model_lib.py", line 27, in <module>
from object_detection import eval_util
File "/content/models/research/object_detection/eval_util.py", line 40, in <module>
slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'
I can't even export my model from checkpoint to inference graph because of the same error.
export_inference_graph.py
Traceback (most recent call last):
File "object_detection/export_inference_graph.py", line 108, in <module>
from object_detection import exporter
File "/content/models/research/object_detection/exporter.py", line 20, in <module>
from tensorflow.contrib.quantize.python import graph_matcher
ModuleNotFoundError: No module named 'tensorflow.contrib'
All three files worked perfectly up until today. Training worked with TF 1.15 and 2.1.0. I was using Colab with Python 3.6 and GPU training. I also could not find any substantial changes recently in the github repo of tensorflow.
Any ideas guys?
I have pyscripter version 3.2.2.0 x86 running python 3.6.3
When I want to import pandas in a py module(i.e. import pandas as pd),
I end up with an exception : invalid syntax
Traceback (most recent call last):
File "<string>", line 424, in run_nodebug
File "<module1>", line 13, in <module>
File "D:\Users\Jean\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\__init__.py", line 13, in <module>
__import__(dependency)
File "D:\Users\Jean\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytz\__init__.py", line 19, in <module>
from pytz.lazy import LazyDict, LazyList, LazySet
File "D:\Users\Jean\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytz\lazy.py", line 3, in <module>
from UserDict import DictMixin
File "D:/Users/Jean\Desktop/Kodi Python Development/PythonPourDebutants/App/Lib\UserDict.py", line 134
raise TypeError, "pop expected at most 2 arguments, got "\
^
SyntaxError: invalid syntax
but when I import in command line, everything is ok !
why is it so ?
thanks for your answers !