11

I decided to take a dip into ML and with a lot of trial and error was able to create a model using TS' inception.

To take this a step further, I want to use their Object Detection API. But their input preparation instructions, references the use of Pascal VOC 2012 dataset but I want to do the training on my own dataset.

Does this mean I need to setup my datasets to either Pascal VOC or Oxford IIT format? If yes, how do I go about doing this?

If no (my instinct says this is the case), what are the alternatives of using TS object detection with my own datasets?

Side Note: I know that my trained inception model can't be used for localization because its a classifier

Edit:

For those still looking to achieve this, here is how I went about doing it.

eshirima
  • 3,677
  • 4
  • 34
  • 57

2 Answers2

13

The training jobs in the Tensorflow Object Detection API expect to get TF Record files with certain fields populated with groundtruth data.

You can either set up your data in the same format as the Pascal VOC or Oxford-IIIT examples, or you can just directly create the TFRecord files ignoring the XML formats.

In the latter case, the create_pet_tf_record.py or create_pascal_tf_record.py scripts are likely to still be useful as a reference for which fields the API expects to see and what format they should take. Currently we do not provide a tool that creates these TFRecord files generally, so you will have to write your own.

Jonathan Huang
  • 1,552
  • 6
  • 12
  • Thank you so much for the guidance.. I actually was already heading down the Pascal Voc generation route. I'll keep you updated with how it turns down. I had another [TS related problem](https://stackoverflow.com/questions/44685875/tensorflow-and-opencv-real-time-classification) if you don't mind taking a look at it as well. Thank you so much!!! – eshirima Jun 29 '17 at 01:02
  • I also have the same issue. Please do tell me what are you going to fill in for data fields like "truncated" or "difficult" since my dataset does not have these fields. – Banach Tarski Jun 29 '17 at 07:27
  • You don't have to fill in the truncated or difficult fields (they will be ignored by the training/eval binaries). – Jonathan Huang Jun 29 '17 at 18:52
  • @JonathanHuang Quick question.. I'm reviewing the _create_pascal_tf_record.py_ script and on this [line](https://github.com/tensorflow/models/blob/master/object_detection/create_pascal_tf_record.py#L162) they explicitly just grab the _aeroplane_train.txt_ only. Why is this so? What about the other classes then? – eshirima Jul 03 '17 at 17:39
  • Oh, don't worry about this --- all of the files in that directory have the same first column (the path to each image) --- we just grab these image paths, so any of the text files would have worked there. – Jonathan Huang Jul 05 '17 at 21:01
  • @eshirima Can you publish the process of converting a custom data set in to Pascal VOC or Oxford-IIIT notation . That would be a great thing – Shamane Siriwardhana Jul 24 '17 at 18:14
  • 1
    @ShamaneSiriwardhana I shared my entire experience [here](https://stackoverflow.com/questions/44973184/train-tensorflow-object-detection-on-own-dataset). Don't forget to up vote if it helps solve your issue. Happy coding, cheers mate :) – eshirima Jul 24 '17 at 18:16
0

Except TF Object Detection API you may look at OpenCV Haar Cascades. I was starting my object detection way from that point and if provide well prepared data set it works pretty fine.

There are also many articles and tutorials about creating your own cascades, so it`s easy to start. I was using this blog, it helps me a lot.

Michael
  • 984
  • 2
  • 11
  • 31
  • I appreciate the suggestion but I already tried Haar Cascades actually before deciding to use the Object Detection API. Two main problems with it. 1: Resizing my object to even 20X40 made my final object look like a blob of black pixels. 2: Once i resized it to the smallest size that still kept its true form, even after letting it run for 48 hours, it didn't even get past stage 0 of training. – eshirima Jul 20 '17 at 11:29