Comments (6)
how to solve this issue please tell me
from models.
Hi @Gaurav061003 ,
Could you please provide the reproducible code and share the exact repo which you are using for training the models if possible.
Thanks
from models.
##Reproducible code
WORKSPACE_PATH = 'Tensorflow/workspace'
SCRIPTS_PATH = 'Tensorflow/scripts'
APIMODEL_PATH = 'Tensorflow/models'
ANNOTATION_PATH = WORKSPACE_PATH+'/annotations'
IMAGE_PATH = WORKSPACE_PATH+'/images'
MODEL_PATH = WORKSPACE_PATH+'/models'
PRETRAINED_MODEL_PATH = WORKSPACE_PATH+'/pre-trained-models'
CONFIG_PATH = MODEL_PATH+'/my_ssd_mobnet/pipeline.config'
CHECKPOINT_PATH = MODEL_PATH+'/my_ssd_mobnet/'
-
Create Label Map
labels = [{'name':'Hello', 'id':1},
{'name':'Yes', 'id':2},
{'name':'No', 'id':3},
{'name':'Thanks', 'id':4},
{'name':'I Love You', 'id':5},
]
with open(ANNOTATION_PATH + '\label_map.pbtxt', 'w') as f:
for label in labels:
f.write('item { \n')
f.write('\tname:'{}'\n'.format(label['name']))
f.write('\tid:{}\n'.format(label['id']))
f.write('}\n') -
Create TF records
import os
def create_tf_record(image_dir, annotation_path, output_path):
os.system(f"python {SCRIPTS_PATH}/generate_tfrecord.py -x {image_dir} -l {annotation_path}/label_map.pbtxt -o {output_path}")
print(f"Successfully created the TFRecord file: {output_path}")
Example usage:
train_image_dir = os.path.join(IMAGE_PATH, 'train')
test_image_dir = os.path.join(IMAGE_PATH, 'test')
train_output_path = os.path.join(ANNOTATION_PATH, 'train.record')
test_output_path = os.path.join(ANNOTATION_PATH, 'test.record')
create_tf_record(train_image_dir, ANNOTATION_PATH, train_output_path)
create_tf_record(test_image_dir, ANNOTATION_PATH, test_output_path)
import os
import urllib.request
import tarfile
def download_pretrained_model(model_name, model_dir):
model_url = f'http://download.tensorflow.org/models/object_detection/tf2/20200711/{model_name}.tar.gz'
model_path = os.path.join(model_dir, f"{model_name}.tar.gz")
# Download the model
urllib.request.urlretrieve(model_url, model_path)
# Extract the downloaded file
with tarfile.open(model_path, 'r:gz') as tar:
tar.extractall(model_dir)
# Remove the compressed file
os.remove(model_path)
print(f"Download and extraction of {model_name} complete.")
Example usage:
pretrained_model_name = 'ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8'
PRETRAINED_MODEL_PATH = 'Tensorflow/workspace/pre-trained-models' # Assuming this is your predefined path
download_pretrained_model(pretrained_model_name, PRETRAINED_MODEL_PATH)
-
Copy Model Config to Training Folder
CUSTOM_MODEL_NAME = 'my_ssd_mobnet'
!mkdir {'Tensorflow\workspace\models\'+CUSTOM_MODEL_NAME} -
Update Config For Transfer Learning
import tensorflow as tf
from google.protobuf import text_format
from object_detection.utils import config_util
from object_detection.protos import pipeline_pb2
##exact repo
C:\Users\RAVI\RealTimeObjectDetection-main\Tensorflow\models\research\object_detection
from models.
Hi @Gaurav061003,
Support for the older codebase has been discontinued. Could you kindly utilize the official Object Detection models provided by TensorFlow Model Garden.
I strongly suggest utilizing the TensorFlow Official Model Garden to circumvent issues related to outdated code commonly found in research codebases. Unlike the research repositories, the Official Model Garden is consistently updated and aligned with the latest changes in TensorFlow and other libraries.
Hope you understanding and Happy coding.
Thanks
from models.
but im using the updated version of [official Object Detection
from models.
hi, I met similar problem that 'cannot import module from 'object_detection.protos', have you solved it? @Gaurav061003
Thanks!
from models.
Related Issues (20)
- Unable to install tf-models-official HOT 6
- GradCAM for MoViNet HOT 2
- models/research/object_detection/exporter_main_v2.py give me error "ImportError: cannot import name 'builder'" HOT 1
- Trying to Load Keras Model Returns ListIndex Error HOT 4
- several errors (4) on movinet streaming_model_training_and_inference notebook when simply ran through on kaggle and colab HOT 7
- Issue with link to MaskConver implementation HOT 1
- How to add additional class (QR Codes) for coco dataset or any suggested dataset for the class I have mentioned HOT 4
- Keras 3 compatibility! HOT 1
- error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. HOT 6
- A model training problem for plant disease detection HOT 10
- Inconsistent result of coco metrics and eval side-by-side.
- cannot import name 'runtime_version' from 'google.protobuf' HOT 2
- Checking training model is overfit or underfit
- Time to use `build` from `setuptools` instead of `distutils`?
- ImportError: cannot import name 'tensor' from 'tensorflow.python.framework ' error fromTensorflow object detection api model_builder_tf2_test.py HOT 2
- Train grayscale image for object detection model and expecting 1 channel tensor input, but it still want 3 channels tensor input HOT 1
- Train grayscale image for object detection model and expecting 1 channel tensor input, but it still want 3 channels tensor input
- Remove tensorflow-text dependency in tf-models-official HOT 4
- ImportError Encountered When Running TensorFlow Object Detection Training Script
- Availability of the pretrained AutosegEdgeTPU-XS backbone HOT 3
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 models.