tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: data/Obj_det.pbtxt : The system cannot find the file specified.
Few things before the start Yes, protobuf was compiled. I ran the basic object_detection model test no problem. That input_reader_pb2 is there along with every other file I made a live camera feed with this object_detection When I try to run model_test_builder in object_detection\builders I get this issue
D:\python_ver\python364\Lib\site-packages\object_detection\builders>python model_builder_test.py
Traceback (most recent call last):
File "model_builder_test.py", line 23, in
This means that protobuf wasn't installed fully correctly which might lead to my main issue down below. But everything was done including exports of path and compilation. I've been on this 2 whole days now. Maybe someone knows the answer. Thank you
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Win10
- TensorFlow installed from (source or binary): Binary
- TensorFlow version (use command below): 1.13.1
- GPU model and memory: no gpu
- Exact command to reproduce: python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
TF version: 1.13.1 Python Version: 3.6.4 protoc version: 3.4
Source code / logs
D:\python_ver\python364\Lib\site-packages\tensorflow\models-master\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
Traceback (most recent call last):
File "train.py", line 49, in
I've used this command and got no errors. It was ran from research folder C:\Users\User\Downloads\protoc\bin\protoc object_detection/protos/*.proto --python_out=.
cd research folder and run this
protoc --python_out=. .\object_detection\protos\input_reader.proto python setup.py build python setup.py install
cd research folder and run this
protoc --python_out=. .\object_detection\protos\input_reader.proto python setup.py build python setup.py install
this is what I'm getting now
Traceback (most recent call last):
File "model_builder.py", line 35, in
cd research folder and run this protoc --python_out=. .\object_detection\protos\input_reader.proto python setup.py build python setup.py install
this is what I'm getting now
Traceback (most recent call last): File "model_builder.py", line 35, in from object_detection.models import faster_rcnn_inception_resnet_v2_feature_extractor as frcnn_inc_res File "D:\python_ver\python364\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\models\faster_rcnn_inception_resnet_v2_feature_extractor.py", line 28, in from nets import inception_resnet_v2 ModuleNotFoundError: No module named 'nets'
you didn't set the paths correctly do the following
set PYTHONPATH=%PYTHONPATH%;[PATH TO RESEARCH FOLDER] set PYTHONPATH=%PYTHONPATH%;[PATH TO SLIM FOLDER INSIDE THE RESEARCH FOLDER]
did it work?
My model test has worked, my live object detection works too. But that's a preset model. Tomorrow I will train my own model and see how it will work. I'll update you. Other than that, thank you so much. Do I have to set this path every time I do something in a different directory location? Also I'm using pycharm combined with just console. Do you think it's a good idea or should I move over to conda? or just linux all together?
yes you have to set it every time, or you can simply move nets folder to current directory but setting pythonpath is much more useful in many ways. i have never used pycharm for object detection, i’m using conda and it’s very useful imo but just stay with the one you’re comfortable
I've used this line python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
and got this
Traceback (most recent call last):
File "legacy/train.py", line 184, in
I know for a fact that this file is inside of data. data folder is in the directory that I'm running the command from. It looks like my path is set incorrectly. Is it something to do with pointing it not at set PYTHONPATH=%PYTHONPATH%;[PATH TO RESEARCH FOLDER] set PYTHONPATH=%PYTHONPATH%;[PATH TO SLIM FOLDER INSIDE THE RESEARCH FOLDER] ?
label_map_path: "data/Obj_det.pbtxt" this is my path in the config file
How much disk memory would I need for like 150 photos?
I've got 140gb on D and 40gb on C. Some people say it might be linked to memory
Hi! Please i cant write good code for model_main.py will run sucsessfully in colab google. I cheked with !ls => model_main.py
!export PYTHONPATH=$PYTHONPATH:/content/gdrive/My Drive/colab_data/models/research/object_detection:/content/gdrive/My Drive/colab_data/models/research/object_detection/slim python content/gdrive/My Drive/colab_data/models/research/object_detection/model_main.py \
--pipeline_config_path=object_detection/my_data/pipeline.config \
--model_dir=object_detection/my_data/output \
--num_train_steps=1000 \
--alsologtostderr
/bin/bash: /content/gdrive/My: No such file or directory
/bin/bash: /content/gdrive/My: No such file or directory
/bin/bash: line 0: export: content/gdrive/My': not a valid identifier
/bin/bash: line 0: export: Drive/colab_data/models/research/object_detection/model_main.py': not a valid identifier
/bin/bash: line 0: export: --pipeline_config_path=object_detection/my_data/pipeline.config': not a valid identifier
/bin/bash: line 0: export: --model_dir=object_detection/my_data/output': not a valid identifier
/bin/bash: line 0: export: --num_train_steps=1000': not a valid identifier
/bin/bash: line 0: export: --alsologtostderr': not a valid identifier
setting a pythonpath does not change your current working directory, it just enables libraries in that direction for you to use them without moving them to working directory. the reason why you’re getting such error is probably because you haven’t edit the paths correctly in the contig file according to current directory. i can’t know how did you configure the folders but i can say that it has nothing to do with memory issue
setting a pythonpath does not change your current working directory, it just enables libraries in that direction for you to use them without moving them to working directory. the reason why you’re getting such error is probably because you haven’t edit the paths correctly in the contig file according to current directory. i can’t know how did you configure the folders but i can say that it has nothing to do with memory issue fine_tune_checkpoint: "/content/gdrive/My Drive/colab_data/models/research/object_detection/ssd_mobilenet_v1_coco_2018_01_28/model.ckpt" from_detection_checkpoint: true num_steps: 20000 } train_input_reader { label_map_path: "/content/gdrive/My Drive/colab_data/models/research/object_detection/my_data/32classes_label_map.pbtxt" tf_record_input_reader { input_path: "/content/gdrive/My Drive/colab_data/models/research/object_detection/my_data/train_data.record" } } eval_config { num_examples: 4280 max_evals: 10 use_moving_averages: false } eval_input_reader { label_map_path: "/content/gdrive/My Drive/colab_data/models/research/object_detection/my_data/32classes_label_map.pbtxt" shuffle: false num_readers: 1 tf_record_input_reader { input_path: "/content/gdrive/My Drive/colab_data/models/research/object_detection/my_data/test_data.record" } }
my paths are set correctly. The file is there and it's contents are what they are meant to be.
train_config: { batch_size: 1 optimizer { rms_prop_optimizer: { learning_rate: { exponential_decay_learning_rate { initial_learning_rate: 0.004 decay_steps: 800720 decay_factor: 0.95 } } momentum_optimizer_value: 0.9 decay: 0.9 epsilon: 1.0 } } fine_tune_checkpoint: "ssd_mobilenet_v1_coco_2017_11_17/model.ckpt" from_detection_checkpoint: true load_all_detection_checkpoint_vars: true
Note: The below line limits the training process to 200K steps, which we
empirically found to be sufficient enough to train the pets dataset. This
effectively bypasses the learning rate schedule (the learning rate will
never decay). Remove the below line to train indefinitely.
num_steps: 200000 data_augmentation_options { random_horizontal_flip { } } data_augmentation_options { ssd_random_crop { } } }
train_input_reader: { tf_record_input_reader { input_path: "data/train.record" } label_map_path: "data/Obj_det.pbtxt" }
eval_config: { metrics_set: "coco_detection_metrics" num_examples: 1100 }
eval_input_reader: { tf_record_input_reader { input_path: "data/test.record" } label_map_path: "data/Obj_det.pbtxt" shuffle: false num_readers: 1 }
can you change the name of obj_det file to maplabel and the path to data/maplabel.pbtxt for both rows in the config file
same error at the end tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: data/maplabel.pbtxt : The system cannot find the file specified. ; No such file or directory
Would I have to update?
WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0. For more information, please see:
- https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
- https://github.com/tensorflow/addons If you depend on functionality not listed there, please file an issue.
WARNING:tensorflow:From D:\python_ver\python364\lib\site-packages\tensorflow\python\platform\app.py:125: main (from main) is deprecated and will be removed in a future version. Instructions for updating: Use object_detection/model_main.py. WARNING:tensorflow:From D:\python_ver\python364\Lib\site-packages\tensorflow\models\research\object_detection\legacy\trainer.py:266: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version. Instructions for updating: Please switch to tf.train.create_global_step WARNING:tensorflow:From D:\python_ver\python364\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating:
I have the exact same problem, any solutions yet?
can you upload your config file
Here is my config file:
# Faster R-CNN with Inception v2, configured for Oxford-IIIT Pets Dataset.
# Users should configure the fine_tune_checkpoint field in the train config as
# well as the label_map_path and input_path fields in the train_input_reader and
# eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that
# should be configured.
model {
faster_rcnn {
num_classes: 2
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
feature_extractor {
type: 'faster_rcnn_inception_v2'
first_stage_features_stride: 16
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
op: CONV
regularizer {
l2_regularizer {
weight: 0.0
}
}
initializer {
truncated_normal_initializer {
stddev: 0.01
}
}
}
first_stage_nms_score_threshold: 0.0
first_stage_nms_iou_threshold: 0.7
first_stage_max_proposals: 300
first_stage_localization_loss_weight: 2.0
first_stage_objectness_loss_weight: 1.0
initial_crop_size: 14
maxpool_kernel_size: 2
maxpool_stride: 2
second_stage_box_predictor {
mask_rcnn_box_predictor {
use_dropout: false
dropout_keep_probability: 1.0
fc_hyperparams {
op: FC
regularizer {
l2_regularizer {
weight: 0.0
}
}
initializer {
variance_scaling_initializer {
factor: 1.0
uniform: true
mode: FAN_AVG
}
}
}
}
}
second_stage_post_processing {
batch_non_max_suppression {
score_threshold: 0.0
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
score_converter: SOFTMAX
}
second_stage_localization_loss_weight: 2.0
second_stage_classification_loss_weight: 1.0
}
}
train_config: {
batch_size: 32
optimizer {
momentum_optimizer: {
learning_rate: {
manual_step_learning_rate {
initial_learning_rate: 0.0002
schedule {
step: 900000
learning_rate: .00002
}
schedule {
step: 1200000
learning_rate: .000002
}
}
}
momentum_optimizer_value: 0.9
}
use_moving_average: false
}
gradient_clipping_by_norm: 10.0
fine_tune_checkpoint: "faster_rcnn_inception_v2_coco_2018_01_28/model.ckpt"
from_detection_checkpoint: true
load_all_detection_checkpoint_vars: true
# Note: The below line limits the training process to 200K steps, which we
# empirically found to be sufficient enough to train the pets dataset. This
# effectively bypasses the learning rate schedule (the learning rate will
# never decay). Remove the below line to train indefinitely.
num_steps: 200000
data_augmentation_options {
random_horizontal_flip {
}
}
}
train_input_reader: {
tf_record_input_reader {
input_path: "data\train.record-?????-of-00010"
}
label_map_path: "data\objectdetection.pbtxt"
}
eval_config: {
metrics_set: "coco_detection_metrics"
num_examples: 1101
}
eval_input_reader: {
tf_record_input_reader {
input_path: "data\test.record-?????-of-00010"
}
label_map_path: "data\objectdetection.pbtxt"
shuffle: false
num_readers: 1
}