Git Product home page Git Product logo

Comments (10)

ahmedghadani avatar ahmedghadani commented on July 24, 2024 1

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.

StarvedHawk avatar StarvedHawk commented on July 24, 2024

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.

nipunwalia avatar nipunwalia commented on July 24, 2024

@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.

ahmedghadani avatar ahmedghadani commented on July 24, 2024

@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.

nipunwalia avatar nipunwalia commented on July 24, 2024

@ahmedghadani thanks man for the help and yes now I get what you meant by "more problems" xD.

from realtimeobjectdetection.

harshitha-8 avatar harshitha-8 commented on July 24, 2024

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.

Syedfaizan3192 avatar Syedfaizan3192 commented on July 24, 2024

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.

SureshbabuAkash1999 avatar SureshbabuAkash1999 commented on July 24, 2024

@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.

satwik834 avatar satwik834 commented on July 24, 2024

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.

sravaniy123 avatar sravaniy123 commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.