Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5f2d4b6
Merge pull request #1 from datitran/master
douglasrizzo Apr 17, 2019
d6a2ef4
script accepts both relative and pixel locations for objects
douglasrizzo Apr 18, 2019
a599645
using argparse instead of tf.app.flags and tqdm to watch tfrecord pro…
douglasrizzo Apr 18, 2019
f38b25a
douglasrizzo Apr 18, 2019
373a19a
split is a private function now
douglasrizzo Apr 18, 2019
cdca83c
xml_to_csv now receives command-line arguments, more flexible and doc…
douglasrizzo Apr 18, 2019
5cd1ed7
created script to generate pbtxt from csv or from a simple txt file
douglasrizzo Apr 18, 2019
26b94b8
removed unnecessary files
douglasrizzo Apr 18, 2019
34b66e4
finished generate_pbtxt
douglasrizzo Apr 18, 2019
89877e1
create a script to generate yolo annotations from csv
douglasrizzo Apr 18, 2019
6282b7c
added some example files
douglasrizzo Apr 18, 2019
a6975aa
rewrote readme
douglasrizzo Apr 18, 2019
dae0c95
working with examples
douglasrizzo Apr 18, 2019
c4f720d
fixed help
douglasrizzo Apr 21, 2019
17e84e0
this has to become a script in the near future
douglasrizzo Apr 21, 2019
efb4501
train/eval separation ipynb became a script
douglasrizzo Apr 23, 2019
86085d4
Update README.md
douglasrizzo Apr 23, 2019
68314ec
csv is now (barelly) generated from VIA annotations
douglasrizzo May 2, 2019
c81f9c3
pbtxt generated from txt file
douglasrizzo May 2, 2019
35da917
changed private function to the beginning of file
douglasrizzo May 5, 2019
1c8fe4a
Update README.md
douglasrizzo Jun 12, 2019
0ec025d
added links to the example files in the README
douglasrizzo Jun 12, 2019
e854454
Update README.md
douglasrizzo Oct 1, 2019
0e895bc
added a DIAGRAM!
douglasrizzo Nov 14, 2019
ae8798f
added line from csv to generate_tfrecord.py
douglasrizzo Feb 19, 2020
5f07596
fix wrong coord conversion in yolo script, add conversion of class to…
douglasrizzo Aug 11, 2020
d43eb80
Modified to use with TF2
Aug 13, 2020
5bc5c90
Address #4
douglasrizzo Sep 4, 2020
ed217f1
switch from 4 to 3 spaces
douglasrizzo Sep 4, 2020
5c4c69c
Update generate_pbtxt.py
Sep 24, 2020
dc0e69b
Update generate_tfrecord.py
Sep 24, 2020
9010126
Merge pull request #1 from ahtesham007/ahtesham007-patch-1
Sep 24, 2020
003e371
Including progress bar
Isaac25silva Oct 10, 2020
6da0aa0
Merge branch 'sjp' into dev
douglasrizzo Oct 11, 2020
4c65fcb
Merge branch 'ahtesham' into dev
douglasrizzo Oct 11, 2020
e848ae8
Merge remote-tracking branch 'Isaac25silva/master' into dev
douglasrizzo Oct 11, 2020
e451689
fix indentation
douglasrizzo Oct 27, 2020
8c94edb
Update README.md
douglasrizzo Dec 15, 2020
b378e45
Update README.md
douglasrizzo Dec 15, 2020
165e029
Update README.md
douglasrizzo Dec 15, 2020
0816891
Update README.md
douglasrizzo Dec 15, 2020
50e862b
Update README.md
douglasrizzo Dec 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Raccoon Detector Dataset
# Object detection utility scripts

This is a dataset that I collected to train my own Raccoon detector with [TensorFlow's Object Detection API](https://github.com/tensorflow/models/tree/master/research/object_detection). Images are from Google and Pixabay. In total, there are 200 images (160 are used for training and 40 for validation).
This repo contains a few Python scripts which may be useful for those trying to create the necessary prerequisite files to train an object detection model, either by using the [TensorFlow Object Detection API](https://github.com/tensorflow/models/tree/master/research/object_detection) or [darknet](https://github.com/alexeyab/darknet).

## Getting Started
Take a look inside the `examples` directory to have an idea of the types of files that these scripts expect as input/generate as output.

##### Folder Structure:
```
+ annotations: contains the xml files in PASCAL VOC format
+ data: contains the input file for the TF object detection API and the label files (csv)
+ images: contains the image data in jpg format
+ training: contains the pipeline configuration file, frozen model and labelmap
- a few handy scripts: generate_tfrecord.py is used to generate the input files
for the TF API and xml_to_csv.py is used to convert the xml files into one csv
- a few jupyter notebooks: draw boxes is used to plot some of the data and
split labels is used to split the full labels into train and test labels
```
## Usage

The repo provides a collection of scripts, which are to be called from the terminal. In order to know what arguments a particular script expects, run it with the `-h` flag to see a help message. For example: `python generate_tfrecord.py -h`. The output files generated by some scripts are used as input files for other scripts. Please take a look at [the flowchart](#script-usage-flowchart) at the end of this page to understand in which order to use them.

* **generate_csv.py** reads the contents of image annotations stored in [XML files](examples/raccoon-197.xml), created with [labelImg](https://github.com/tzutalin/labelImg), and generates a single [CSV file](examples/raccoon_labels.csv).
* **generate_train_eval.py** reads the CSV file and separates it into train and evaluation datasets, which are also CSV files. There are options to stratify by class and to select which fraction of the input CSV will be directed to the train dataset (the rest going to evaluation).
* **generate_pbtxt.py** reads the previously generated CSV file (or any CSV file that has a column named _"class"_) or a text file containing a single class name per line and no header, and generates a [label map](examples/label_map.pbtxt), one of the files needed to train a detection model using [TensorFlow's Object Detection API](https://github.com/tensorflow/models/tree/master/research/object_detection).
* **generate_tfrecord.py** reads the previously generated CSV and label map files, as well as all the images from a given directory, and generates a TFRecord file, which can then be used to train an object detection model with TensorFlow. The resulting TFRecord file is about the same size of all the original images that were included in it.
* **generate_yolo_txt.py** reads the CSV file and generates one .txt file for each image mentioned in the CSV file, whith the same name of the image file. These .txt files contain the object annotations for that image, in a format which [darknet](https://pjreddie.com/darknet/yolo/) uses to train its models.

### Script usage flowchart

![](diagram.svg)

## Copyright

See [LICENSE](LICENSE) for details.
Copyright (c) 2017 [Dat Tran](http://www.dat-tran.com/).
Licenses are so complicated. This work began as a fork of [Dat Tran's](http://www.dat-tran.com/) raccoon dataset repository, but then it became its own thing. Anyway, the license is unchanged and is in the repo.
Empty file removed __init__.py
Empty file.
26 changes: 0 additions & 26 deletions annotations/raccoon-1.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-10.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-100.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-101.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-102.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-103.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-104.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-105.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-106.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-107.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-108.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-109.xml

This file was deleted.

26 changes: 0 additions & 26 deletions annotations/raccoon-11.xml

This file was deleted.

Loading