Skip to content

Commit a4944a5

Browse files
derekjchowsguada
authored andcommitted
Add Tensorflow Object Detection API. (tensorflow#1561)
For details see our paper: "Speed/accuracy trade-offs for modern convolutional object detectors." Huang J, Rathod V, Sun C, Zhu M, Korattikara A, Fathi A, Fischer I, Wojna Z, Song Y, Guadarrama S, Murphy K, CVPR 2017 https://arxiv.org/abs/1611.10012
1 parent 60c3ed2 commit a4944a5

File tree

224 files changed

+40616
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+40616
-0
lines changed

object_detection/BUILD

+178
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Tensorflow Object Detection API: main runnables.
2+
3+
package(
4+
default_visibility = ["//visibility:public"],
5+
)
6+
7+
licenses(["notice"])
8+
9+
# Apache 2.0
10+
11+
py_binary(
12+
name = "train",
13+
srcs = [
14+
"train.py",
15+
],
16+
deps = [
17+
":trainer",
18+
"//tensorflow",
19+
"//tensorflow_models/object_detection/builders:input_reader_builder",
20+
"//tensorflow_models/object_detection/builders:model_builder",
21+
"//tensorflow_models/object_detection/protos:input_reader_py_pb2",
22+
"//tensorflow_models/object_detection/protos:model_py_pb2",
23+
"//tensorflow_models/object_detection/protos:pipeline_py_pb2",
24+
"//tensorflow_models/object_detection/protos:train_py_pb2",
25+
],
26+
)
27+
28+
py_library(
29+
name = "trainer",
30+
srcs = ["trainer.py"],
31+
deps = [
32+
"//tensorflow",
33+
"//tensorflow_models/object_detection/builders:optimizer_builder",
34+
"//tensorflow_models/object_detection/builders:preprocessor_builder",
35+
"//tensorflow_models/object_detection/core:batcher",
36+
"//tensorflow_models/object_detection/core:standard_fields",
37+
"//tensorflow_models/object_detection/utils:ops",
38+
"//tensorflow_models/object_detection/utils:variables_helper",
39+
"//tensorflow_models/slim:model_deploy",
40+
],
41+
)
42+
43+
py_test(
44+
name = "trainer_test",
45+
srcs = ["trainer_test.py"],
46+
deps = [
47+
":trainer",
48+
"//tensorflow",
49+
"//tensorflow_models/object_detection/core:losses",
50+
"//tensorflow_models/object_detection/core:model",
51+
"//tensorflow_models/object_detection/core:standard_fields",
52+
"//tensorflow_models/object_detection/protos:train_py_pb2",
53+
],
54+
)
55+
56+
py_library(
57+
name = "eval_util",
58+
srcs = [
59+
"eval_util.py",
60+
],
61+
deps = [
62+
"//tensorflow",
63+
"//tensorflow_models/object_detection/utils:label_map_util",
64+
"//tensorflow_models/object_detection/utils:object_detection_evaluation",
65+
"//tensorflow_models/object_detection/utils:visualization_utils",
66+
],
67+
)
68+
69+
py_library(
70+
name = "evaluator",
71+
srcs = ["evaluator.py"],
72+
deps = [
73+
"//tensorflow",
74+
"//tensorflow_models/object_detection:eval_util",
75+
"//tensorflow_models/object_detection/core:box_list",
76+
"//tensorflow_models/object_detection/core:box_list_ops",
77+
"//tensorflow_models/object_detection/core:prefetcher",
78+
"//tensorflow_models/object_detection/core:standard_fields",
79+
"//tensorflow_models/object_detection/protos:eval_py_pb2",
80+
],
81+
)
82+
83+
py_binary(
84+
name = "eval",
85+
srcs = [
86+
"eval.py",
87+
],
88+
deps = [
89+
":evaluator",
90+
"//tensorflow",
91+
"//tensorflow_models/object_detection/builders:input_reader_builder",
92+
"//tensorflow_models/object_detection/builders:model_builder",
93+
"//tensorflow_models/object_detection/protos:eval_py_pb2",
94+
"//tensorflow_models/object_detection/protos:input_reader_py_pb2",
95+
"//tensorflow_models/object_detection/protos:model_py_pb2",
96+
"//tensorflow_models/object_detection/protos:pipeline_py_pb2",
97+
"//tensorflow_models/object_detection/utils:label_map_util",
98+
],
99+
)
100+
101+
py_library(
102+
name = "exporter",
103+
srcs = [
104+
"exporter.py",
105+
],
106+
deps = [
107+
"//tensorflow",
108+
"//tensorflow/python/tools:freeze_graph_lib",
109+
"//tensorflow_models/object_detection/builders:model_builder",
110+
"//tensorflow_models/object_detection/core:standard_fields",
111+
"//tensorflow_models/object_detection/data_decoders:tf_example_decoder",
112+
],
113+
)
114+
115+
py_test(
116+
name = "exporter_test",
117+
srcs = [
118+
"exporter_test.py",
119+
],
120+
deps = [
121+
":exporter",
122+
"//tensorflow",
123+
"//tensorflow_models/object_detection/builders:model_builder",
124+
"//tensorflow_models/object_detection/core:model",
125+
"//tensorflow_models/object_detection/protos:pipeline_py_pb2",
126+
],
127+
)
128+
129+
py_binary(
130+
name = "export_inference_graph",
131+
srcs = [
132+
"export_inference_graph.py",
133+
],
134+
deps = [
135+
":exporter",
136+
"//tensorflow",
137+
"//tensorflow_models/object_detection/protos:pipeline_py_pb2",
138+
],
139+
)
140+
141+
py_binary(
142+
name = "create_pascal_tf_record",
143+
srcs = [
144+
"create_pascal_tf_record.py",
145+
],
146+
deps = [
147+
"//third_party/py/PIL:pil",
148+
"//third_party/py/lxml",
149+
"//tensorflow",
150+
"//tensorflow_models/object_detection/utils:dataset_util",
151+
"//tensorflow_models/object_detection/utils:label_map_util",
152+
],
153+
)
154+
155+
py_test(
156+
name = "create_pascal_tf_record_test",
157+
srcs = [
158+
"create_pascal_tf_record_test.py",
159+
],
160+
deps = [
161+
":create_pascal_tf_record",
162+
"//tensorflow",
163+
],
164+
)
165+
166+
py_binary(
167+
name = "create_pet_tf_record",
168+
srcs = [
169+
"create_pet_tf_record.py",
170+
],
171+
deps = [
172+
"//third_party/py/PIL:pil",
173+
"//third_party/py/lxml",
174+
"//tensorflow",
175+
"//tensorflow_models/object_detection/utils:dataset_util",
176+
"//tensorflow_models/object_detection/utils:label_map_util",
177+
],
178+
)

object_detection/CONTRIBUTING.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Contributing to the Tensorflow Object Detection API
2+
3+
Patches to Tensorflow Object Detection API are welcome!
4+
5+
We require contributors to fill out either the individual or corporate
6+
Contributor License Agreement (CLA).
7+
8+
* If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html).
9+
* If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html).
10+
11+
Please follow the
12+
[Tensorflow contributing guidelines](https://github.com/tensorflow/tensorflow/blob/master/CONTRIBUTING.md)
13+
when submitting pull requests.

object_detection/README.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Tensorflow Object Detection API
2+
Creating accurate machine learning models capable of localizing and identifying
3+
multiple objects in a single image remains a core challenge in computer vision.
4+
The TensorFlow Object Detection API is an open source framework built on top of
5+
TensorFlow that makes it easy to construct, train and deploy object detection
6+
models. At Google we’ve certainly found this codebase to be useful for our
7+
computer vision needs, and we hope that you will as well.
8+
<p align="center">
9+
<img src="g3doc/img/kites_detections_output.jpg" width=676 height=450>
10+
</p>
11+
Contributions to the codebase are welcome and we would love to hear back from
12+
you if you find this API useful. Finally if you use the Tensorflow Object
13+
Detection API for a research publication, please consider citing:
14+
15+
```
16+
"Speed/accuracy trade-offs for modern convolutional object detectors."
17+
Huang J, Rathod V, Sun C, Zhu M, Korattikara A, Fathi A, Fischer I, Wojna Z,
18+
Song Y, Guadarrama S, Murphy K, CVPR 2017
19+
```
20+
\[[link](https://arxiv.org/abs/1611.10012)\]\[[bibtex](
21+
https://scholar.googleusercontent.com/scholar.bib?q=info:l291WsrB-hQJ:scholar.google.com/&output=citation&scisig=AAGBfm0AAAAAWUIIlnPZ_L9jxvPwcC49kDlELtaeIyU-&scisf=4&ct=citation&cd=-1&hl=en&scfhb=1)\]
22+
23+
## Maintainers
24+
25+
* Jonathan Huang, github: [jch1](https://github.com/jch1)
26+
* Vivek Rathod, github: [tombstone](https://github.com/tombstone)
27+
* Derek Chow, github: [derekjchow](https://github.com/derekjchow)
28+
* Chen Sun, github: [jesu9](https://github.com/jesu9)
29+
* Menglong Zhu, github: [dreamdragon](https://github.com/dreamdragon)
30+
31+
32+
## Table of contents
33+
34+
Quick Start:
35+
* <a href='object_detection_tutorial.ipynb'>
36+
Quick Start: Jupyter notebook for off-the-shelf inference</a><br>
37+
* <a href="g3doc/running_pets.md">Quick Start: Training on a pet detector</a><br>
38+
39+
Setup:
40+
* <a href='g3doc/installation.md'>Installation</a><br>
41+
* <a href='g3doc/configuring_jobs.md'>
42+
Configuring an object detection pipeline</a><br>
43+
* <a href='g3doc/preparing_inputs.md'>Preparing inputs</a><br>
44+
45+
Running:
46+
* <a href='g3doc/running_locally.md'>Running locally</a><br>
47+
* <a href='g3doc/running_on_cloud.md'>Running on the cloud</a><br>
48+
49+
Extras:
50+
* <a href='g3doc/detection_model_zoo.md'>Tensorflow detection model zoo</a><br>
51+
* <a href='g3doc/exporting_models.md'>
52+
Exporting a trained model for inference</a><br>
53+
* <a href='g3doc/defining_your_own_model.md'>
54+
Defining your own model architecture</a><br>
55+
56+
## Release information
57+
58+
### June 15, 2017
59+
60+
In addition to our base Tensorflow detection model definitions, this
61+
release includes:
62+
63+
* A selection of trainable detection models, including:
64+
* Single Shot Multibox Detector (SSD) with MobileNet,
65+
* SSD with Inception V2,
66+
* Region-Based Fully Convolutional Networks (R-FCN) with Resnet 101,
67+
* Faster RCNN with Resnet 101,
68+
* Faster RCNN with Inception Resnet v2
69+
* Mask R-CNN with Resnet 101.
70+
* Frozen weights (trained on the COCO dataset) for each of the above models to
71+
be used for out-of-the-box inference purposes.
72+
* A [Jupyter notebook](object_detection_tutorial.ipynb) for performing
73+
out-of-the-box inference with one of our released models
74+
* Convenient [local training](g3doc/running_locally.md) scripts as well as
75+
distributed training and evaluation pipelines via
76+
[Google Cloud](g3doc/running_on_cloud.md).
77+
78+
79+
<b>Thanks to contributors</b>: Jonathan Huang, Vivek Rathod, Derek Chow,
80+
Chen Sun, Menglong Zhu, Matthew Tang, Anoop Korattikara, Alireza Fathi, Ian Fischer, Zbigniew Wojna, Yang Song, Sergio Guadarrama, Jasper Uijlings,
81+
Viacheslav Kovalevskyi, Kevin Murphy

object_detection/__init__.py

Whitespace-only changes.
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Tensorflow Object Detection API: Anchor Generator implementations.
2+
3+
package(
4+
default_visibility = ["//visibility:public"],
5+
)
6+
7+
licenses(["notice"])
8+
9+
# Apache 2.0
10+
py_library(
11+
name = "grid_anchor_generator",
12+
srcs = [
13+
"grid_anchor_generator.py",
14+
],
15+
deps = [
16+
"//tensorflow",
17+
"//tensorflow_models/object_detection/core:anchor_generator",
18+
"//tensorflow_models/object_detection/core:box_list",
19+
"//tensorflow_models/object_detection/utils:ops",
20+
],
21+
)
22+
23+
py_test(
24+
name = "grid_anchor_generator_test",
25+
srcs = [
26+
"grid_anchor_generator_test.py",
27+
],
28+
deps = [
29+
":grid_anchor_generator",
30+
"//tensorflow",
31+
],
32+
)
33+
34+
py_library(
35+
name = "multiple_grid_anchor_generator",
36+
srcs = [
37+
"multiple_grid_anchor_generator.py",
38+
],
39+
deps = [
40+
":grid_anchor_generator",
41+
"//tensorflow",
42+
"//tensorflow_models/object_detection/core:anchor_generator",
43+
"//tensorflow_models/object_detection/core:box_list_ops",
44+
],
45+
)
46+
47+
py_test(
48+
name = "multiple_grid_anchor_generator_test",
49+
srcs = [
50+
"multiple_grid_anchor_generator_test.py",
51+
],
52+
deps = [
53+
":multiple_grid_anchor_generator",
54+
"//third_party/py/numpy",
55+
],
56+
)

object_detection/anchor_generators/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)