generating an error record generate_tfrecord.py tfrecord

This article is the author on Windows 10 with python3.6 + Tensorflow gpu 1.9.0 to issue egohand (a hand detection dataset) encountered in the training process:
from scratch to begin with, I have seen a copy on github training to achieve hand recognition source
https://github.com/victordibia/handtracking
run through it again. It has actually run a success. Just use the original model of training has been completed.

The second step is to use Tensorflow retrain again on the source of training data set.

Briefly steps:

  1. Hand detection data downloaded
    from
    http://vision.soic.indiana.edu/projects/egohands/

  2. Organize your data
    without having to manually unzip the archive, but the use of the code to complete the collation of data and extract the
    egohands_dataset_clean.py git repository in order to complete the following work

If you do not download the current catalog egohands_data.zip that call download_egohands_dataset () recommended this step into its own archive manually download a good first and then copy in, avoid downloading process interrupted
or unzip egohands_data.zip and get egohands folder, and where the picture data execution rename_files ()
rename_files () will rename all the pictures, plus the name of its parent folder, the name of the picture to avoid duplication and to call generate_csv_files ()
generate_csv_files () under the picture read each scene, call get_bbox_visualize (), according to documents marked polygons.mat hand drawn outline and Anchor Box and displays, while the picture is converted and stored as a label csv file, all dealt with, then call split_data_test_eval_train ()
split_data_test_eval_train () to complete the training and testing stripe set, the images in two file folders train and test new folders were stored images and corresponding csv marked
the completion of the above work, you can manually delete the beginning of egohands unpack folder

3. Call generate_tfrecord.py (not the git in from https://github.com/datitran/raccoon_dataset/blob/master/generate_tfrecord.py
directly copied over), will organize the training and test sets to TFRecord file

Because here only need to check the hand, so only one object category that is hand, if you need a more custom object detection tasks, the following code can be modified generate_tfrecord.py

def class_text_to_int(row_label):
    if row_label == 'hand':
        return 1
    else:
        None

接下来将generate_tfrecord.py放到与egohands_dataset_clean.py同级目录中,运行
python generate_tfrecord.py --csv_input=images/train/train_labels.csv --output_path=train.record
报如下错误:
Traceback (most recent call last):
File "generate_tfrecord.py", line 100, in <module>
tf.app.run()
File "D:\PycharmProjects\OpenCV_Tensor_Env\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "generate_tfrecord.py", line 91, in main
tf_example = create_tf_example(group, path)
File "generate_tfrecord.py", line 46, in create_tf_example
encoded_jpg = fid.read()
File "D:\PycharmProjects\OpenCV_Tensor_Env\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 125, in read
self._preread_check()
File "D:\PycharmProjects\OpenCV_Tensor_Env\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "D:\PycharmProjects\OpenCV_Tensor_Env\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 519, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: CARDS_COURTYARD_B_T_frame_0011.jpg : ϵͳ\udcd5Ҳ\udcbb\udcb5\udcbdָ\udcb6\udca8\udcb5\udcc4\udcceļ\udcfe\udca1\udca3
; No such file or directory

The last line error to create, open CARDS_COURTYARD_B_T_frame_0011.jpg file fails
CARDS_COURTYARD_B_T_frame_0011.jpg file in the images / train / directory, I believe that taking the time to find the path generate_tfrecord read the file modifications can be.
I stole a lazy down, since it is to get the picture files in this directory, as long as the generate_tfrecord move to the images / train / directory
and then run
python generate_tfrecord.py --csv_input=train_labels.csv --output_path=train.record
to generate train.record success.

Online stackflow, the mentioned changes in the system environment, run with linux. This step is consuming too much, it is recommended first by the author steps to try to see.

Guess you like

Origin blog.51cto.com/cfy10/2446070