[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run model builder test for Object Detection API #64152

Open
smtc7648 opened this issue Mar 21, 2024 · 4 comments
Open

Unable to run model builder test for Object Detection API #64152

smtc7648 opened this issue Mar 21, 2024 · 4 comments
Assignees
Labels
type:build/install Build and install issues

Comments

@smtc7648
Copy link

Issue type

Build/Install

Have you reproduced the bug with TensorFlow Nightly?

No

Source

source

TensorFlow version

v2.16.1-0-g5bc9d26649c 2.16.1

Custom code

No

OS platform and distribution

Mac OS Sonoma 14.4

Mobile device

No response

Python version

3.10

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

While running the below script
python3 models/research/object_detection/builders/model_builder_tf2_test.py

I'm getting following error:
Traceback (most recent call last):
File "/Users/smitparmar/Desktop/ML/custom-object-detection/models/research/object_detection/builders/model_builder_tf2_test.py", line 24, in
from object_detection.builders import model_builder
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/object_detection/builders/model_builder.py", line 26, in
from object_detection.builders import hyperparams_builder
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/object_detection/builders/hyperparams_builder.py", line 27, in
from object_detection.core import freezable_sync_batch_norm
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/object_detection/core/freezable_sync_batch_norm.py", line 20, in
class FreezableSyncBatchNorm(tf.keras.layers.experimental.SyncBatchNormalization
AttributeError: module 'keras._tf_keras.keras.layers' has no attribute 'experimental'

Standalone code to reproduce the issue

https://drive.google.com/file/d/18z2bj-xRlXT2J6QvplLiYv2uoLei_1bX/view?usp=sharing

Relevant log output

This output is from google colab and above one is from my local machine Apple MacBook Pro with M1 Pro. (Tensowflow Metal is also installed)

2024-03-21 11:07:15.432006: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-03-21 11:07:16.927430: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
  File "/content/models/research/object_detection/builders/model_builder_tf2_test.py", line 24, in <module>
    from object_detection.builders import model_builder
  File "/usr/local/lib/python3.10/dist-packages/object_detection/builders/model_builder.py", line 26, in <module>
    from object_detection.builders import hyperparams_builder
  File "/usr/local/lib/python3.10/dist-packages/object_detection/builders/hyperparams_builder.py", line 27, in <module>
    from object_detection.core import freezable_sync_batch_norm
  File "/usr/local/lib/python3.10/dist-packages/object_detection/core/freezable_sync_batch_norm.py", line 20, in <module>
    class FreezableSyncBatchNorm(tf.keras.layers.experimental.SyncBatchNormalization
AttributeError: module 'keras._tf_keras.keras.layers' has no attribute 'experimental'
@google-ml-butler google-ml-butler bot added the type:build/install Build and install issues label Mar 21, 2024
@NBCBM
Copy link
NBCBM commented Mar 21, 2024

import tensorflow as tf
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.models import Model
from tensorflow.keras.applications import EfficientNetB0

Example usage of BatchNormalization

inputs = tf.keras.Input(shape=(32, 32, 3))
x = EfficientNetB0(include_top=False, input_tensor=inputs)
x = BatchNormalization()(x.output)
outputs = tf.keras.layers.Dense(10, activation='softmax')(x)
model = Model(inputs=inputs, outputs=outputs)

Rest of your code

@smtc7648
Copy link
Author
smtc7648 commented Mar 23, 2024

import tensorflow as tf
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.models import Model
from tensorflow.keras.applications import EfficientNetB0

Example usage of BatchNormalization

inputs = tf.keras.Input(shape=(32, 32, 3))
x = EfficientNetB0(include_top=False, input_tensor=inputs)
x = BatchNormalization()(x.output)
outputs = tf.keras.layers.Dense(10, activation='softmax')(x)
model = Model(inputs=inputs, outputs=outputs)

Rest of your code

Thanks for the response.
Could you please check the link mentioned above to reproduce the issue?

@mark-nicepants
Copy link

Following this tutorial i also ran into the same problem.
https://blog.roboflow.com/train-a-tensorflow2-object-detection-model/

It points to this Colab:
https://colab.research.google.com/drive/1sLqFKVV94wm-lglFq_0kGo2ciM0kecWD

And after a couple of steps (not Roboflow related part of the setup). It crashes on this step:

image

@smtc7648
Copy link
Author

Hey @mark-nicepants, Thanks for your response. I'll surely try out your suggestion.
However, I was able to get some success and will share the link shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

4 participants