Comments (10)
The solution mentioned by @StarvedHawk works and the TF records are generated successfully, however, it does not work for the configuration when executing:
config = config_util.get_configs_from_pipeline_file(CONFIG_PATH)
This is the output, (notice tf.io.gfile.GFile
is there but somehow it is not being recognized):
AttributeError: module 'tensorflow' has no attribute 'gfile'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_12928/2792951555.py in <module>
----> 1 config = config_util.get_configs_from_pipeline_file(CONFIG_PATH)
~\anaconda3\envs\ssd-net\lib\site-packages\object_detection\utils\config_util.py in get_configs_from_pipeline_file(pipeline_config_path, config_override)
94 """
95 pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
---> 96 with tf.io.gfile.GFile(pipeline_config_path, "r") as f:
97 proto_str = f.read()
98 text_format.Merge(proto_str, pipeline_config)
AttributeError: module 'tensorflow' has no attribute 'gfile'
After updating Jupiter to the latest version, I got another error which exactly as the one mentioned here Training SSD-MobilenetV2 fails with Message type "object_detection.protos.TrainConfig" has no field named "fine_tune_checkpoint_version" #9297
Applying the solution mentioned here solved it deleting the "fine-tuning checkpoint version" line from the configuration file
from realtimeobjectdetection.
In order for it to work the following changes need to be implemented :
in generate_tfrecord.py:
label_map = label_map_util.load_labelmap(args.labels_path)
label_map_dict = label_map_util.get_label_map_dict(label_map)
as
label_map_dict = label_map_util.get_label_map_dict(args.labels_path)
in label_map_util.py :
tf.gfile.GFile(name,mode_code)
to
tf.io.gfile.GFile(name,mode=mode_code)
from realtimeobjectdetection.
@ahmedghadani can you help me with the exact line that's supposed to be deleted. I can't find it in the config_util.py file.
from realtimeobjectdetection.
@nipunwalia Hi, I don't remember exactly, but I don't think it was in config_util.py, rather it was in the pipeline.config file. You will find this file in a path similar to this YOUR_USERNAME\RealTimeObjectDetection\Tensorflow\workspace\models\my_ssd_mobnet\pipeline.config
It should be somewhere around line 172 if nothing has been changed since last time I tried this. Friendly warning though, I remember facing more problems going forward after fixing this xD.
Please let me know if you find that line there. I will have to dig a little bit deeper to verify it from my side
from realtimeobjectdetection.
@ahmedghadani thanks man for the help and yes now I get what you meant by "more problems" xD.
from realtimeobjectdetection.
I'm newbie and trying the tutorial I found on youtube. Everything is perfect until I came to the 'Creating TF Records' part. I see many errors, the first one is no module found: pandas, I solved it. Then I encounter with an error which says File "Tensorflow/scripts/generate_tfrecord.py", line 29, in from object_detection.utils import dataset_util, label_map_util ModuleNotFoundError: No module named 'object_detection'
I search this error and I write 'pip install tensorflow-object-detection-api' in cmd. Then I encounter another error which says,
File "Tensorflow/scripts/generate_tfrecord.py", line 61, in label_map = label_map_util.load_labelmap(args.labels_path) File "C:\Python38\lib\site-packages\object_detection\utils\label_map_util.py", line 132, in load_labelmap with tf.gfile.GFile(path, 'r') as fid: AttributeError: module 'tensorflow' has no attribute 'gfile'
Do you have any ide how to fix? Or should I pass this part?
In order for it to work the following changes need to be implemented : in generate_tfrecord.py:
label_map = label_map_util.load_labelmap(args.labels_path) label_map_dict = label_map_util.get_label_map_dict(label_map)
as
label_map_dict = label_map_util.get_label_map_dict(args.labels_path)
in label_map_util.py :
tf.gfile.GFile(name,mode_code)
to
tf.io.gfile.GFile(name,mode=mode_code)
I was rectifying the error and trying to edit in label_map_util.py but here already tf.io.gfile.GFile is there , but still getting an error
the line of code which is giving error is : with tf.io.gfile.GFile(path,mode='r') as fid:
Any leads about this? if you could help me it would be a great.
from realtimeobjectdetection.
Traceback (most recent call last):
File "Tensorflow/scripts/generate_tfrecord.py", line 29, in
from object_detection.utils import dataset_util, label_map_util
ModuleNotFoundError: No module named 'object_detection'
Traceback (most recent call last):
File "Tensorflow/scripts/generate_tfrecord.py", line 29, in
from object_detection.utils import dataset_util, label_map_util
ModuleNotFoundError: No module named 'object_detection
Kindly guide me anyone?
from realtimeobjectdetection.
@harshitha-8 Go to this address: C:\Users---\AppData\Local\Programs\Python\Python39\Lib\site-packages\object_detection\utils\label_map_util.py in your pc and do the same changes there.
from realtimeobjectdetection.
hello
while generating tf records im getting an error
Traceback (most recent call last):
File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 168, in
tf.app.run()
File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow\python\platform\app.py", line 36, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\absl\app.py", line 312, in run
_run_main(main, args)
File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\absl\app.py", line 258, in _run_main
sys.exit(main(argv))
File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 158, in main
tf_example = create_tf_example(group, path)
File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 132, in create_tf_example
classes.append(class_text_to_int(row['class']))
File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 101, in class_text_to_int
return label_map_dict[row_label]
KeyError: 'hello'
Traceback (most recent call last):
File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 168, in
tf.app.run()
File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow\python\platform\app.py", line 36, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\absl\app.py", line 312, in run
_run_main(main, args)
File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\absl\app.py", line 258, in _run_main
sys.exit(main(argv))
File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 158, in main
tf_example = create_tf_example(group, path)
File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 132, in create_tf_example
classes.append(class_text_to_int(row['class']))
File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 101, in class_text_to_int
return label_map_dict[row_label]
KeyError: 'hello'
please help
from realtimeobjectdetection.
hello while generating tf records im getting an error Traceback (most recent call last): File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 168, in tf.app.run() File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow\python\platform\app.py", line 36, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\absl\app.py", line 312, in run _run_main(main, args) File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\absl\app.py", line 258, in _run_main sys.exit(main(argv)) File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 158, in main tf_example = create_tf_example(group, path) File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 132, in create_tf_example classes.append(class_text_to_int(row['class'])) File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 101, in class_text_to_int return label_map_dict[row_label] KeyError: 'hello' Traceback (most recent call last): File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 168, in tf.app.run() File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow\python\platform\app.py", line 36, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\absl\app.py", line 312, in run _run_main(main, args) File "C:\Users\new\AppData\Local\Programs\Python\Python310\lib\site-packages\absl\app.py", line 258, in _run_main sys.exit(main(argv)) File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 158, in main tf_example = create_tf_example(group, path) File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 132, in create_tf_example classes.append(class_text_to_int(row['class'])) File "G:\hand\RealTimeObjectDetection\Tensorflow\scripts\generate_tfrecord.py", line 101, in class_text_to_int return label_map_dict[row_label] KeyError: 'hello'
please help
MEE TOO PLEASE HELP
from realtimeobjectdetection.
Related Issues (20)
- python Tensorflow/models/research/object_detection/model_main_tf2.py --model_dir=Tensorflow/workspace/models/my_ssd_mobnet --pipeline_config_path=Tensorflow/workspace/models/my_ssd_mobnet/pipeline.config --num_train_steps=10000 HOT 1
- Unable to resolve an error HOT 1
- Dimension issue HOT 2
- Image Augmentation with label datasets
- cp is not reconginzed as internal or external command. CP error in Adminstrator Command Prompt HOT 2
- Couldn't satisfy the requirements
- train.record and test.record empty
- issue while generating tf records HOT 2
- ModuleNotFoundError: No module named 'tensorflow.contrib' HOT 1
- Collected Image is Empty
- cv2 issue
- 'cp' is not recognized as an internal or external command, operable program or batch file. HOT 1
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd1 in position 221: invalid continuation byte
- pyrcc5 was unexpected at this time.
- 'numpy._DTypeMeta' object is not subscriptable HOT 1
- gfile HOT 2
- error creating in creating tf record HOT 1
- how to train a model to read book and give answers according to the user
- Issue - run on Colab
- error during git clone
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realtimeobjectdetection.