automl icon indicating copy to clipboard operation
automl copied to clipboard

How to convert train TFREcord for my own dataset

Open HK017 opened this issue 6 years ago • 7 comments

please tell me, How to generate a dataset o tfrecord format? thanks a lot!!!

HK017 avatar Mar 23 '20 06:03 HK017

Working on it now. will check in the code in 1 or 2 days.

mingxingtan avatar Mar 23 '20 06:03 mingxingtan

Maybe you can follow this scricp @HK017 https://github.com/tensorflow/models/blob/master/research/object_detection/dataset_tools/create_coco_tf_record.py

moyans avatar Mar 23 '20 09:03 moyans

I had some tfrecords that works fine with faster rcnn here https://github.com/tensorflow/models/tree/master/research/object_detection

But it fails with

tensorflow.python.framework.errors_impl.InvalidArgumentError: StringToNumberOp could not correctly convert string: ab3faf098c4a7147b9d6397611fdc289-crop.jpg
         [[{{node parser/StringToNumber}}]]
         [[IteratorGetNext]]

Anyone knows why?

philip-fu avatar Mar 23 '20 21:03 philip-fu

e with faster rcnn here

set "image/source_id" as a number like "0" "1"...

huangxiaosa avatar Mar 24 '20 02:03 huangxiaosa

@huangxiaosa could you please eleborate. Should this line https://github.com/tensorflow/tpu/blob/master/tools/datasets/create_coco_tf_record.py#L126 ,be set to dataset_util.bytes_feature(0),

zishanahmed08 avatar Mar 24 '20 21:03 zishanahmed08

Hi all, thanks for pointing out the problems. Please don't use the tensorflow tools, since that tool is a little outdated. You can convert your dataset using the following command line:

Here are some examples:

// Download coco data. $ wget http://images.cocodataset.org/zips/val2017.zip $ wget http://images.cocodataset.org/annotations/annotations_trainval2017.zip $ unzip val2017.zip $ unzip annotations_trainval2017.zip

// convert coco data to tfrecord. $ mkdir tfrecrod $ PYTHONPATH=".:$PYTHONPATH" python dataset/create_coco_tfrecord.py
--image_dir=val2017
--caption_annotations_file=annotations/captions_val2017.json
--output_file_prefix=tfrecord/val
--num_shards=32

For more information, please refer to our Tutorial

mingxingtan avatar Mar 24 '20 21:03 mingxingtan

I am going to close this bug now, but please feel free to reopen it if you still have problems. Thanks!

mingxingtan avatar Mar 24 '20 21:03 mingxingtan