C3W2_Zombie_detection_Exercise1

Hi,

I am facing a challenge importing the model_builder from the object_detection.utils as illustrated below:

<ipython-input-4-acc72192bdbe> in <cell line: 12>()
     10 
     11 # import module for building the detection model
---> 12 from object_detection.utils import model_builder
     13 ### END CODE HERE ###
     14 

ImportError: cannot import name 'model_builder' from 'object_detection.utils' (/usr/local/lib/python3.10/dist-packages/object_detection/utils/__init__.py)

Please advise,

Thanks,
Sheila

1 Like

Hello @Sheila_Murunga

the above code is incorrect as you are try import the module from utils which is incorrect package to import model_builder.

for building objection_detection model you need to use builders package for importing model_builder.

  • From the builders package:
    • model_builder: This builds your model according to the model configuration that you’ll specify.

Regards
DP

Hello @Deepti_Prasad,

Great to hear from you again :slight_smile:

Thanks for this(this is embarrassing! :face_with_peeking_eye: I cant believe I put utils instead of builders.

However, am still getting the another error that I was grappling with through various attempts hence the embarrassing confusion.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-58c818709b7f> in <cell line: 12>()
     10 
     11 # import module for building the detection model
---> 12 from object_detection.builders import model_builder
     13 ### END CODE HERE ###
     14 

2 frames
/usr/local/lib/python3.10/dist-packages/object_detection/core/freezable_sync_batch_norm.py in <module>
     18 
     19 
---> 20 class FreezableSyncBatchNorm(tf.keras.layers.experimental.SyncBatchNormalization
     21                             ):
     22   """Sync Batch normalization layer (Ioffe and Szegedy, 2014).

AttributeError: module 'keras._tf_keras.keras.layers' has no attribute 'experimental'

Please help

Sheila

1 Like

Is this error for the same grader cell where you import modules?

Got the same error, may be the model builder package provided is outdated.

@Deepti_Prasad, yes, not in my local computer, this time :slight_smile:

1 Like

Hello @Sheila_Murunga

Could you confirm me if you had any metadata error on installing object detection API??

Regards
DP

Hi @Deepti_Prasad,

No meta error as shown below:

1 Like

Please send me codes for the cell you encountered error via personal DM. Click on my name and then message.

Regards
DP

Hi everyone. This has now been patched. Looks like there’s a compatibility issue with TF2.16 so we have to rollback to use TF2.15. Kindly reopen your notebook from the classroom to see the revision. Thank you for reporting!

4 Likes

Hi @Deepti_Prasad

Sorry for the late response. I just got on this platform now. It has been sorted by @chris.favila so I will have to go back to the notebook then try running it again.

Thanks so much for your help

Sheila

2 Likes

Thanks @chris.favila

2 Likes

Hello @Sheila_Murunga

I had only informed Chris about your issue.

Regards
DP

1 Like

Thanks @Deepti_Prasad

1 Like