BUILD 9.28 KB
Newer Older
1
2
3
4
5
6
# Tensorflow Object Detection API: main runnables.

package(
    default_visibility = ["//visibility:public"],
)

7
8
load("//learning/brain/contrib/learn/tpu:tpu.bzl", "cloud_tpu_py_binaries")

9
10
11
licenses(["notice"])

# Apache 2.0
12

13
14
exports_files(["LICENSE"])

15
16
17
18
19
20
21
22
py_library(
    name = "inputs",
    srcs = [
        "inputs.py",
    ],
    deps = [
        "//tensorflow",
        "//tensorflow/models/research/object_detection/builders:dataset_builder",
23
24
        "//tensorflow/models/research/object_detection/builders:image_resizer_builder",
        "//tensorflow/models/research/object_detection/builders:model_builder",
25
26
        "//tensorflow/models/research/object_detection/builders:preprocessor_builder",
        "//tensorflow/models/research/object_detection/protos:input_reader_py_pb2",
27
        "//tensorflow/models/research/object_detection/protos:model_py_pb2",
28
        "//tensorflow/models/research/object_detection/protos:train_py_pb2",
29
        "//tensorflow/models/research/object_detection/utils:config_util",
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
        "//tensorflow/models/research/object_detection/utils:dataset_util",
        "//tensorflow/models/research/object_detection/utils:ops",
    ],
)

py_test(
    name = "inputs_test",
    srcs = [
        "inputs_test.py",
    ],
    data = [
        "//tensorflow/models/research/object_detection/data:pet_label_map.pbtxt",
        "//tensorflow/models/research/object_detection/samples/configs:faster_rcnn_resnet50_pets.config",
        "//tensorflow/models/research/object_detection/samples/configs:ssd_inception_v2_pets.config",
        "//tensorflow/models/research/object_detection/test_data:pets_examples.record",
    ],
    deps = [
        ":inputs",
        "//tensorflow",
        "//tensorflow/models/research/object_detection/core:standard_fields",
        "//tensorflow/models/research/object_detection/utils:config_util",
    ],
)

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
py_binary(
    name = "model",
    srcs = [
        "model.py",
    ],
    deps = [
        ":inputs",
        ":model_hparams",
        "//tensorflow",
        "//tensorflow/models/research/object_detection:eval_util",
        "//tensorflow/models/research/object_detection/builders:model_builder",
        "//tensorflow/models/research/object_detection/builders:optimizer_builder",
        "//tensorflow/models/research/object_detection/metrics:coco_evaluation",
        "//tensorflow/models/research/object_detection/utils:config_util",
        "//tensorflow/models/research/object_detection/utils:label_map_util",
        "//tensorflow/models/research/object_detection/utils:ops",
        "//tensorflow/models/research/object_detection/utils:shape_utils",
        "//tensorflow/models/research/object_detection/utils:variables_helper",
        "//tensorflow/models/research/object_detection/utils:visualization_utils",
    ],
)

py_library(
    name = "model_hparams",
    srcs = [
        "model_hparams.py",
    ],
    deps = [
        "//tensorflow",
    ],
)

py_test(
    name = "model_test",
    timeout = "long",
    srcs = [
        "model_test.py",
    ],
    data = [
        "//tensorflow/models/research/object_detection/data:pet_label_map.pbtxt",
        "//tensorflow/models/research/object_detection/samples/configs:faster_rcnn_resnet50_pets.config",
        "//tensorflow/models/research/object_detection/samples/configs:ssd_inception_v2_pets.config",
        "//tensorflow/models/research/object_detection/test_data:pets_examples.record",
    ],
    deps = [
        ":inputs",
        ":model",
        ":model_hparams",
        ":model_test_util",
        "//mock",
        "//tensorflow",
        "//tensorflow/models/research/object_detection/core:standard_fields",
        "//tensorflow/models/research/object_detection/data_decoders:tf_example_decoder",
        "//tensorflow/models/research/object_detection/utils:config_util",
        "//tensorflow/models/research/object_detection/utils:ops",
    ],
)

MODEL_TPU_DEPS = [
    ":inputs",
    ":model",
    ":model_hparams",
    "//tensorflow",
    "//tensorflow/models/research/object_detection:eval_util",
    "//tensorflow/models/research/object_detection/builders:model_builder",
    "//tensorflow/models/research/object_detection/builders:optimizer_builder",
    "//tensorflow/models/research/object_detection/metrics:coco_evaluation",
    "//tensorflow/models/research/object_detection/utils:config_util",
    "//tensorflow/models/research/object_detection/utils:label_map_util",
    "//tensorflow/models/research/object_detection/utils:ops",
    "//tensorflow/models/research/object_detection/utils:variables_helper",
    "//tensorflow/models/research/object_detection/utils:visualization_utils",
]

cloud_tpu_py_binaries(
    name = "model_tpu",
    srcs = [
        "model_tpu.py",
    ],
    main = "model_tpu.py",
    deps = MODEL_TPU_DEPS,
)

py_library(
    name = "model_tpu_lib",
    srcs = [
        "model_tpu.py",
    ],
    deps = MODEL_TPU_DEPS,
)

py_library(
    name = "model_test_util",
    srcs = [
        "model_test_util.py",
    ],
    deps = [
        ":model",
        ":model_hparams",
        "//tensorflow",
    ],
)

157
158
159
160
161
162
163
164
py_binary(
    name = "train",
    srcs = [
        "train.py",
    ],
    deps = [
        ":trainer",
        "//tensorflow",
165
166
167
168
        "//tensorflow/models/research/object_detection/builders:dataset_builder",
        "//tensorflow/models/research/object_detection/builders:model_builder",
        "//tensorflow/models/research/object_detection/utils:config_util",
        "//tensorflow/models/research/object_detection/utils:dataset_util",
169
170
171
172
173
174
175
176
    ],
)

py_library(
    name = "trainer",
    srcs = ["trainer.py"],
    deps = [
        "//tensorflow",
177
178
179
180
181
182
183
184
        "//tensorflow/models/research/object_detection/builders:optimizer_builder",
        "//tensorflow/models/research/object_detection/builders:preprocessor_builder",
        "//tensorflow/models/research/object_detection/core:batcher",
        "//tensorflow/models/research/object_detection/core:preprocessor",
        "//tensorflow/models/research/object_detection/core:standard_fields",
        "//tensorflow/models/research/object_detection/utils:ops",
        "//tensorflow/models/research/object_detection/utils:variables_helper",
        "//third_party/tensorflow_models/slim:model_deploy",
185
186
187
188
189
190
191
192
193
    ],
)

py_test(
    name = "trainer_test",
    srcs = ["trainer_test.py"],
    deps = [
        ":trainer",
        "//tensorflow",
194
195
196
197
        "//tensorflow/models/research/object_detection/core:losses",
        "//tensorflow/models/research/object_detection/core:model",
        "//tensorflow/models/research/object_detection/core:standard_fields",
        "//tensorflow/models/research/object_detection/protos:train_py_pb2",
198
199
200
201
202
203
204
205
206
207
    ],
)

py_library(
    name = "eval_util",
    srcs = [
        "eval_util.py",
    ],
    deps = [
        "//tensorflow",
208
209
210
211
212
213
214
        "//tensorflow/models/research/object_detection/core:box_list",
        "//tensorflow/models/research/object_detection/core:box_list_ops",
        "//tensorflow/models/research/object_detection/core:keypoint_ops",
        "//tensorflow/models/research/object_detection/core:standard_fields",
        "//tensorflow/models/research/object_detection/utils:label_map_util",
        "//tensorflow/models/research/object_detection/utils:ops",
        "//tensorflow/models/research/object_detection/utils:visualization_utils",
215
216
217
218
219
220
221
222
    ],
)

py_library(
    name = "evaluator",
    srcs = ["evaluator.py"],
    deps = [
        "//tensorflow",
223
224
225
        "//tensorflow/models/research/object_detection:eval_util",
        "//tensorflow/models/research/object_detection/core:prefetcher",
        "//tensorflow/models/research/object_detection/core:standard_fields",
226
        "//tensorflow/models/research/object_detection/metrics:coco_evaluation",
227
228
        "//tensorflow/models/research/object_detection/protos:eval_py_pb2",
        "//tensorflow/models/research/object_detection/utils:object_detection_evaluation",
229
230
231
232
233
234
235
236
237
238
239
    ],
)

py_binary(
    name = "eval",
    srcs = [
        "eval.py",
    ],
    deps = [
        ":evaluator",
        "//tensorflow",
240
241
242
243
244
        "//tensorflow/models/research/object_detection/builders:dataset_builder",
        "//tensorflow/models/research/object_detection/builders:model_builder",
        "//tensorflow/models/research/object_detection/utils:config_util",
        "//tensorflow/models/research/object_detection/utils:dataset_util",
        "//tensorflow/models/research/object_detection/utils:label_map_util",
245
246
247
248
249
250
251
252
253
254
255
    ],
)

py_library(
    name = "exporter",
    srcs = [
        "exporter.py",
    ],
    deps = [
        "//tensorflow",
        "//tensorflow/python/tools:freeze_graph_lib",
256
257
258
        "//tensorflow/models/research/object_detection/builders:model_builder",
        "//tensorflow/models/research/object_detection/core:standard_fields",
        "//tensorflow/models/research/object_detection/data_decoders:tf_example_decoder",
259
260
261
262
263
264
265
266
267
268
269
    ],
)

py_test(
    name = "exporter_test",
    srcs = [
        "exporter_test.py",
    ],
    deps = [
        ":exporter",
        "//tensorflow",
270
271
272
        "//tensorflow/models/research/object_detection/builders:model_builder",
        "//tensorflow/models/research/object_detection/core:model",
        "//tensorflow/models/research/object_detection/protos:pipeline_py_pb2",
273
274
275
276
277
278
279
280
281
282
283
    ],
)

py_binary(
    name = "export_inference_graph",
    srcs = [
        "export_inference_graph.py",
    ],
    deps = [
        ":exporter",
        "//tensorflow",
284
        "//tensorflow/models/research/object_detection/protos:pipeline_py_pb2",
285
286
    ],
)