Open agnieszkajust opened 3 years ago
Hi I'm new to TensorFlow community, can anyone guide me how to approach/get started with issues like this? (I tried to replicate it but I'm getting a different error) Thanks in advance! :)
go to the research directory and type:
export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim
Hi, @agnieszkajust thanks for helping me, now it is showing cannot import 'model_lib_v2'
.
I tried to fix that by running
python setup.py build
python setup.py install
but it wasn't working.
I printed the contents of the object_detection
package, model_lib_v2
was not present in it.
Can you please suggest what should I do?
What version of tensorflow and which branch 'tensorflow/models' do you have?
@agnieszkajust I have Tensorflow 2.3.0 and working on the r2.3.0
branch of "tensorflow/models".
After reinstalling above errors didn't occur.
But now I'm getting
Traceback (most recent call last):
File "model_main_tf2.py", line 112, in <module>
tf.app.run()
AttributeError: module 'tensorflow.compat.v2' has no attribute 'app'
Tf2 doesn't have attribute "app", do I have to change it to tf.compat.v1.app.run()
, why this change is not merged into branch r2.3.0?
I don't know, but I also changed to tf.compat.v1.app.run().
@agnieszkajust how do you solve the problem of name 'contrib_training' is not defined
I don't solve it.
My workaround in utils/autoaugment_utils.py
:
from tensorflow_addons import image as contrib_image
from collections import namedtuple
# pylint: disable=g-import-not-at-top
# try:
# from tensorflow.contrib import image as contrib_image
# from tensorflow.contrib import training as contrib_training
# except ImportError:
# # TF 2.0 doesn't ship with contrib.
# pass
# pylint: enable=g-import-not-at-top
...
def hparams(**kwargs):
return namedtuple("HParams", kwargs.keys())(*kwargs.values())
# Line 1670
augmentation_hparams = hparams(
cutout_max_pad_fraction=0.75,
cutout_bbox_replace_with_mean=False,
cutout_const=100,
translate_const=250,
cutout_bbox_const=50,
translate_bbox_const=120)
https://github.com/tensorflow/models/tree/r2.3.0/research/object_detection
Describe:
After run: python model_main_tf2.py --model_dir=$MODEL_DIR --num_train_steps=$NUM_TRAIN_STEPS --sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES --pipeline_config_path=$PIPELINE_CONFIG_PATH --alsologtostderr I got: hparams = contrib_training.HParams( NameError: name 'contrib_training' is not defined
System information:
How can I solve it?