String_int_label_map_pb2

i am facing error in importing the package

2024-03-14 18:27:45.737052: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
WARNING:tensorflow:From c:\Users\VCC\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy
instead.

Traceback (most recent call last):
File “c:\Users\VCC\Documents\Pick-2-lite\colab ipynb files\from object_detection.py”, line 1, in
from object_detection.utils import label_map_util
File “c:\Users\VCC\AppData\Local\Programs\Python\Python310\lib\site-packages\object_detection\utils\label_map_util.py”, line 21, in
from object_detection.protos import string_int_label_map_pb2
ImportError: cannot import name ‘string_int_label_map_pb2’ from ‘object_detection.protos’ (c:\Users\VCC\AppData\Local\Programs\Python\Python310\lib\site-packages\object_detection\protos_init_.py)

how to solve this and i need to run these files in vs code. is it possible to run in vs code?

Hi @Sujithra47,

Sorry for the delayed response. It is possible to run this example from VS code. Please make sure to run the following steps:

1. git clone https://github.com/tensorflow/models.git
    cd models/research 
2. sudo apt install -y protobuf-compiler
   cd models/research/
   protoc object_detection/protos/*.proto --python_out=.
   cp object_detection/packages/tf2/setup.py .
   python -m pip install .

It generates the string_int_label_map_pb2.py file.

3. Add the models/research directory to your Python path
``` export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim

Resource link: 1

Thank You