models icon indicating copy to clipboard operation
models copied to clipboard

create more than one tf.record files for object dection training

Open civilman628 opened this issue 9 years ago • 12 comments

Now the object detection API provides the sample code to create tf.record file for PASCAL VOC in create_pascal_tf_record.py

But it only generates one file training and one file for validation. This will cause the single file is very large and hard to load into memory, especially on our own dataset. furthermore, the model config file can only assign one file for training and validation as well in 'input_path'.

We need a more flexible to let training process to read more than one files one by one, just like in classification model, train-001.record, train-002.record...

civilman628 avatar Aug 01 '17 17:08 civilman628

You can refer to this script pascalvoc_to_tfrecords.py, this SSD implemented in Tensoflow creates a list of tfrecords.

MetaPeak avatar Aug 02 '17 02:08 MetaPeak

thanks, but in config file for training, you can only assign one file but not a folder path, which contains training files.

civilman628 avatar Aug 02 '17 18:08 civilman628

I guess this is a feature request, but not sure whether community support is feasible. @martinwicke ?

poxvoculi avatar Aug 04 '17 19:08 poxvoculi

Which model is this for? Whoever is in the readme should take a look.

martinwicke avatar Aug 04 '17 19:08 martinwicke

for detection model:

https://github.com/tensorflow/models/tree/master/object_detection/samples/configs

now all config files here can only read one training and validation file, instead of assign a folder.

civilman628 avatar Aug 04 '17 19:08 civilman628

You can assign input_path such as "YOUR_TFREOCRDS/train_*.tfrecords"

balansky avatar Aug 26 '17 21:08 balansky

Thanks @balansky for the clarification.

It seems the create_pascal_tf_record.py creates tfrecord for a single object category. How do we train for multiple object categories using the object detection API?

tvkpz avatar Sep 04 '17 08:09 tvkpz

I have the same question for multiple classes. Can anyone help with this?

P-a-i-s avatar Jan 09 '18 12:01 P-a-i-s

Hi @balansky ,

For training multiple classes, do you need individual train and val tfrecords for each class? And then, would you need to train the network separately for each class?

Many of my train images contain object instances across classes. It would be most efficient to keep all images in one directory and create single tfexamples for each image that can list annotations for multiple classes. Can the object detection api train this way for multiple labels/classifications?

Alternatively, @tvkpz how did you end up any creating tfrecords and training for multiple categories?

danamyu avatar Mar 15 '18 16:03 danamyu

@tvkpz your question is wrong. you can always train more than one class in one tr.record. One image can contains many different classes. It is not one tf.record file for one class. This is wrong way to train. Shuffle classes are very important to make network converge.

civilman628 avatar Mar 15 '18 16:03 civilman628

Hi There, We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing. If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.

tensorflowbutler avatar Jan 29 '20 23:01 tensorflowbutler

Can I make tf_record for multiple classes at once?

yashmukaty avatar Apr 17 '20 11:04 yashmukaty