BUILD 12 KB
Newer Older
1
# Description:
2
#   Contains files for loading, training and evaluating TF-Slim-based models.
3

4
5
6
package(
    default_visibility = ["//visibility:public"],
)
7
8
9
10
11
12
13
14

licenses(["notice"])  # Apache 2.0

exports_files(["LICENSE"])

py_library(
    name = "dataset_utils",
    srcs = ["datasets/dataset_utils.py"],
Derek Chow's avatar
Derek Chow committed
15
16
17
    deps = [
        "//tensorflow",
    ],
18
19
)

derekjchow's avatar
derekjchow committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
sh_binary(
    name = "download_and_convert_imagenet",
    srcs = ["datasets/download_and_convert_imagenet.sh"],
    data = [
        "datasets/download_imagenet.sh",
        "datasets/imagenet_2012_validation_synset_labels.txt",
        "datasets/imagenet_lsvrc_2015_synsets.txt",
        "datasets/imagenet_metadata.txt",
        "datasets/preprocess_imagenet_validation_data.py",
        "datasets/process_bounding_boxes.py",
        ":build_imagenet_data",
    ],
)

py_binary(
    name = "build_imagenet_data",
    srcs = ["datasets/build_imagenet_data.py"],
    deps = [
38
        # "//numpy",
derekjchow's avatar
derekjchow committed
39
40
41
42
        "//tensorflow",
    ],
)

43
py_library(
44
45
    name = "download_and_convert_cifar10",
    srcs = ["datasets/download_and_convert_cifar10.py"],
Derek Chow's avatar
Derek Chow committed
46
47
    deps = [
        ":dataset_utils",
48
        # "//numpy",
Derek Chow's avatar
Derek Chow committed
49
50
        "//tensorflow",
    ],
51
52
)

53
py_library(
54
55
    name = "download_and_convert_flowers",
    srcs = ["datasets/download_and_convert_flowers.py"],
Derek Chow's avatar
Derek Chow committed
56
57
58
59
    deps = [
        ":dataset_utils",
        "//tensorflow",
    ],
60
61
)

62
py_library(
63
64
    name = "download_and_convert_mnist",
    srcs = ["datasets/download_and_convert_mnist.py"],
Derek Chow's avatar
Derek Chow committed
65
66
    deps = [
        ":dataset_utils",
67
        # "//numpy",
Derek Chow's avatar
Derek Chow committed
68
69
        "//tensorflow",
    ],
70
71
)

72
73
74
75
76
77
78
py_binary(
    name = "download_and_convert_data",
    srcs = ["download_and_convert_data.py"],
    deps = [
        ":download_and_convert_cifar10",
        ":download_and_convert_flowers",
        ":download_and_convert_mnist",
79
        "//tensorflow",
80
81
82
    ],
)

83
84
85
py_binary(
    name = "cifar10",
    srcs = ["datasets/cifar10.py"],
Derek Chow's avatar
Derek Chow committed
86
87
88
89
    deps = [
        ":dataset_utils",
        "//tensorflow",
    ],
90
91
92
93
94
)

py_binary(
    name = "flowers",
    srcs = ["datasets/flowers.py"],
Derek Chow's avatar
Derek Chow committed
95
96
97
98
    deps = [
        ":dataset_utils",
        "//tensorflow",
    ],
99
100
101
102
103
)

py_binary(
    name = "imagenet",
    srcs = ["datasets/imagenet.py"],
Derek Chow's avatar
Derek Chow committed
104
105
106
107
    deps = [
        ":dataset_utils",
        "//tensorflow",
    ],
108
109
110
111
112
)

py_binary(
    name = "mnist",
    srcs = ["datasets/mnist.py"],
Derek Chow's avatar
Derek Chow committed
113
114
115
116
    deps = [
        ":dataset_utils",
        "//tensorflow",
    ],
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
)

py_library(
    name = "dataset_factory",
    srcs = ["datasets/dataset_factory.py"],
    deps = [
        ":cifar10",
        ":flowers",
        ":imagenet",
        ":mnist",
    ],
)

py_library(
    name = "model_deploy",
132
    srcs = ["deployment/model_deploy.py"],
Derek Chow's avatar
Derek Chow committed
133
134
135
    deps = [
        "//tensorflow",
    ],
136
137
138
139
)

py_test(
    name = "model_deploy_test",
140
    srcs = ["deployment/model_deploy_test.py"],
141
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
142
143
    deps = [
        ":model_deploy",
144
        # "//numpy",
Derek Chow's avatar
Derek Chow committed
145
146
        "//tensorflow",
    ],
147
148
149
)

py_library(
150
151
    name = "cifarnet_preprocessing",
    srcs = ["preprocessing/cifarnet_preprocessing.py"],
Derek Chow's avatar
Derek Chow committed
152
153
154
    deps = [
        "//tensorflow",
    ],
155
156
157
158
)

py_library(
    name = "inception_preprocessing",
159
    srcs = ["preprocessing/inception_preprocessing.py"],
Derek Chow's avatar
Derek Chow committed
160
161
    deps = [
        "//tensorflow",
162
        "//tensorflow/python:control_flow_ops",
Derek Chow's avatar
Derek Chow committed
163
    ],
164
165
166
167
)

py_library(
    name = "lenet_preprocessing",
168
    srcs = ["preprocessing/lenet_preprocessing.py"],
Derek Chow's avatar
Derek Chow committed
169
170
171
    deps = [
        "//tensorflow",
    ],
172
173
174
175
)

py_library(
    name = "vgg_preprocessing",
176
    srcs = ["preprocessing/vgg_preprocessing.py"],
Derek Chow's avatar
Derek Chow committed
177
178
179
    deps = [
        "//tensorflow",
    ],
180
181
182
183
)

py_library(
    name = "preprocessing_factory",
184
    srcs = ["preprocessing/preprocessing_factory.py"],
185
    deps = [
186
        ":cifarnet_preprocessing",
187
188
189
        ":inception_preprocessing",
        ":lenet_preprocessing",
        ":vgg_preprocessing",
Derek Chow's avatar
Derek Chow committed
190
        "//tensorflow",
191
192
193
    ],
)

194
195
196
197
198
199
200
# Typical networks definitions.

py_library(
    name = "nets",
    deps = [
        ":alexnet",
        ":cifarnet",
201
        ":cyclegan",
202
203
        ":inception",
        ":lenet",
andrewghoward's avatar
andrewghoward committed
204
        ":mobilenet_v1",
205
        ":nasnet",
206
        ":overfeat",
207
        ":pix2pix",
208
209
210
211
212
213
214
215
216
217
        ":resnet_v1",
        ":resnet_v2",
        ":vgg",
    ],
)

py_library(
    name = "alexnet",
    srcs = ["nets/alexnet.py"],
    srcs_version = "PY2AND3",
218
    deps = ["//tensorflow"],
219
220
221
222
223
224
225
)

py_test(
    name = "alexnet_test",
    size = "medium",
    srcs = ["nets/alexnet_test.py"],
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
226
227
228
229
    deps = [
        ":alexnet",
        "//tensorflow",
    ],
230
231
232
233
234
)

py_library(
    name = "cifarnet",
    srcs = ["nets/cifarnet.py"],
Derek Chow's avatar
Derek Chow committed
235
236
237
    deps = [
        "//tensorflow",
    ],
238
239
)

240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
py_library(
    name = "cyclegan",
    srcs = ["nets/cyclegan.py"],
    deps = [
        # "//numpy",
        "//tensorflow",
    ],
)

py_test(
    name = "cyclegan_test",
    srcs = ["nets/cyclegan_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
    deps = [
        ":cyclegan",
        "//tensorflow",
    ],
)

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

py_test(
    name = "dcgan_test",
    srcs = ["nets/dcgan_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
    deps = [
        ":dcgan",
        "//tensorflow",
    ],
)

279
280
281
282
283
284
285
286
287
py_library(
    name = "inception",
    srcs = ["nets/inception.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":inception_resnet_v2",
        ":inception_v1",
        ":inception_v2",
        ":inception_v3",
Alex Kurakin's avatar
Alex Kurakin committed
288
        ":inception_v4",
289
290
291
    ],
)

Alex Kurakin's avatar
Alex Kurakin committed
292
293
294
295
py_library(
    name = "inception_utils",
    srcs = ["nets/inception_utils.py"],
    srcs_version = "PY2AND3",
296
    deps = ["//tensorflow"],
Alex Kurakin's avatar
Alex Kurakin committed
297
298
)

299
300
301
302
py_library(
    name = "inception_v1",
    srcs = ["nets/inception_v1.py"],
    srcs_version = "PY2AND3",
Alex Kurakin's avatar
Alex Kurakin committed
303
304
    deps = [
        ":inception_utils",
305
        "//tensorflow",
Alex Kurakin's avatar
Alex Kurakin committed
306
    ],
307
308
309
310
311
312
)

py_library(
    name = "inception_v2",
    srcs = ["nets/inception_v2.py"],
    srcs_version = "PY2AND3",
Alex Kurakin's avatar
Alex Kurakin committed
313
314
    deps = [
        ":inception_utils",
315
        "//tensorflow",
Alex Kurakin's avatar
Alex Kurakin committed
316
    ],
317
318
319
320
321
322
)

py_library(
    name = "inception_v3",
    srcs = ["nets/inception_v3.py"],
    srcs_version = "PY2AND3",
Alex Kurakin's avatar
Alex Kurakin committed
323
324
    deps = [
        ":inception_utils",
325
        "//tensorflow",
Alex Kurakin's avatar
Alex Kurakin committed
326
327
328
329
330
331
332
333
334
    ],
)

py_library(
    name = "inception_v4",
    srcs = ["nets/inception_v4.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":inception_utils",
335
        "//tensorflow",
Alex Kurakin's avatar
Alex Kurakin committed
336
    ],
337
338
339
340
341
342
)

py_library(
    name = "inception_resnet_v2",
    srcs = ["nets/inception_resnet_v2.py"],
    srcs_version = "PY2AND3",
343
    deps = ["//tensorflow"],
344
345
346
347
348
349
350
351
)

py_test(
    name = "inception_v1_test",
    size = "large",
    srcs = ["nets/inception_v1_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
352
353
    deps = [
        ":inception",
354
        # "//numpy",
Derek Chow's avatar
Derek Chow committed
355
356
        "//tensorflow",
    ],
357
358
359
360
361
362
363
364
)

py_test(
    name = "inception_v2_test",
    size = "large",
    srcs = ["nets/inception_v2_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
365
366
    deps = [
        ":inception",
367
        # "//numpy",
Derek Chow's avatar
Derek Chow committed
368
369
        "//tensorflow",
    ],
370
371
372
373
374
375
376
377
)

py_test(
    name = "inception_v3_test",
    size = "large",
    srcs = ["nets/inception_v3_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
378
379
    deps = [
        ":inception",
380
        # "//numpy",
Derek Chow's avatar
Derek Chow committed
381
382
        "//tensorflow",
    ],
383
384
)

Alex Kurakin's avatar
Alex Kurakin committed
385
386
387
388
389
390
py_test(
    name = "inception_v4_test",
    size = "large",
    srcs = ["nets/inception_v4_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
391
392
393
394
    deps = [
        ":inception",
        "//tensorflow",
    ],
Alex Kurakin's avatar
Alex Kurakin committed
395
396
)

397
398
399
400
401
402
py_test(
    name = "inception_resnet_v2_test",
    size = "large",
    srcs = ["nets/inception_resnet_v2_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
403
404
405
406
    deps = [
        ":inception",
        "//tensorflow",
    ],
407
408
)

409
410
411
py_library(
    name = "lenet",
    srcs = ["nets/lenet.py"],
Derek Chow's avatar
Derek Chow committed
412
413
414
    deps = [
        "//tensorflow",
    ],
415
416
)

andrewghoward's avatar
andrewghoward committed
417
418
419
420
py_library(
    name = "mobilenet_v1",
    srcs = ["nets/mobilenet_v1.py"],
    srcs_version = "PY2AND3",
421
    deps = ["//tensorflow"],
andrewghoward's avatar
andrewghoward committed
422
423
424
425
426
427
428
429
430
431
)

py_test(
    name = "mobilenet_v1_test",
    size = "large",
    srcs = ["nets/mobilenet_v1_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
    deps = [
        ":mobilenet_v1",
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
        # "//numpy",
        "//tensorflow",
    ],
)

py_library(
    name = "nasnet_utils",
    srcs = ["nets/nasnet/nasnet_utils.py"],
    srcs_version = "PY2AND3",
    deps = [
        "//tensorflow",
    ],
)

py_library(
    name = "nasnet",
    srcs = ["nets/nasnet/nasnet.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":nasnet_utils",
        "//tensorflow",
    ],
)

py_test(
    name = "nasnet_utils_test",
    size = "medium",
    srcs = ["nets/nasnet/nasnet_utils_test.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":nasnet_utils",
        "//tensorflow",
    ],
)

py_test(
    name = "nasnet_test",
    size = "large",
    srcs = ["nets/nasnet/nasnet_test.py"],
    shard_count = 10,
    srcs_version = "PY2AND3",
    deps = [
        ":nasnet",
Derek Chow's avatar
Derek Chow committed
475
        "//tensorflow",
andrewghoward's avatar
andrewghoward committed
476
477
478
    ],
)

479
py_library(
480
481
482
    name = "overfeat",
    srcs = ["nets/overfeat.py"],
    srcs_version = "PY2AND3",
483
    deps = ["//tensorflow"],
484
485
486
487
488
489
490
)

py_test(
    name = "overfeat_test",
    size = "medium",
    srcs = ["nets/overfeat_test.py"],
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
491
492
493
494
    deps = [
        ":overfeat",
        "//tensorflow",
    ],
495
496
)

497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
py_library(
    name = "pix2pix",
    srcs = ["nets/pix2pix.py"],
    srcs_version = "PY2AND3",
    deps = ["//tensorflow"],
)

py_test(
    name = "pix2pix_test",
    srcs = ["nets/pix2pix_test.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":pix2pix",
        "//tensorflow",
    ],
)

514
515
516
517
py_library(
    name = "resnet_utils",
    srcs = ["nets/resnet_utils.py"],
    srcs_version = "PY2AND3",
518
    deps = ["//tensorflow"],
519
520
521
522
523
524
525
526
)

py_library(
    name = "resnet_v1",
    srcs = ["nets/resnet_v1.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":resnet_utils",
527
        "//tensorflow",
528
529
530
531
532
533
534
    ],
)

py_test(
    name = "resnet_v1_test",
    size = "medium",
    srcs = ["nets/resnet_v1_test.py"],
Derek Chow's avatar
Derek Chow committed
535
    shard_count = 2,
536
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
537
    deps = [
538
        ":resnet_utils",
Derek Chow's avatar
Derek Chow committed
539
        ":resnet_v1",
540
        # "//numpy",
Derek Chow's avatar
Derek Chow committed
541
542
        "//tensorflow",
    ],
543
544
545
546
547
548
549
550
)

py_library(
    name = "resnet_v2",
    srcs = ["nets/resnet_v2.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":resnet_utils",
551
        "//tensorflow",
552
553
554
555
556
557
558
    ],
)

py_test(
    name = "resnet_v2_test",
    size = "medium",
    srcs = ["nets/resnet_v2_test.py"],
Derek Chow's avatar
Derek Chow committed
559
    shard_count = 2,
560
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
561
    deps = [
562
        ":resnet_utils",
Derek Chow's avatar
Derek Chow committed
563
        ":resnet_v2",
564
        # "//numpy",
Derek Chow's avatar
Derek Chow committed
565
566
        "//tensorflow",
    ],
567
568
569
570
571
572
)

py_library(
    name = "vgg",
    srcs = ["nets/vgg.py"],
    srcs_version = "PY2AND3",
573
    deps = ["//tensorflow"],
574
575
576
577
578
579
580
)

py_test(
    name = "vgg_test",
    size = "medium",
    srcs = ["nets/vgg_test.py"],
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
581
582
583
584
    deps = [
        ":vgg",
        "//tensorflow",
    ],
585
586
587
588
589
)

py_library(
    name = "nets_factory",
    srcs = ["nets/nets_factory.py"],
Derek Chow's avatar
Derek Chow committed
590
591
592
593
    deps = [
        ":nets",
        "//tensorflow",
    ],
594
595
596
597
598
599
)

py_test(
    name = "nets_factory_test",
    size = "medium",
    srcs = ["nets/nets_factory_test.py"],
Derek Chow's avatar
Derek Chow committed
600
    shard_count = 2,
601
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
602
603
604
605
    deps = [
        ":nets_factory",
        "//tensorflow",
    ],
606
607
608
609
610
611
612
613
614
615
)

py_binary(
    name = "train_image_classifier",
    srcs = ["train_image_classifier.py"],
    deps = [
        ":dataset_factory",
        ":model_deploy",
        ":nets_factory",
        ":preprocessing_factory",
Derek Chow's avatar
Derek Chow committed
616
        "//tensorflow",
617
    ],
618
619
620
)

py_binary(
621
622
    name = "eval_image_classifier",
    srcs = ["eval_image_classifier.py"],
623
624
    deps = [
        ":dataset_factory",
625
        ":nets_factory",
626
        ":preprocessing_factory",
Derek Chow's avatar
Derek Chow committed
627
        "//tensorflow",
628
629
    ],
)
630
631
632
633
634
635
636

py_binary(
    name = "export_inference_graph",
    srcs = ["export_inference_graph.py"],
    deps = [
        ":dataset_factory",
        ":nets_factory",
Derek Chow's avatar
Derek Chow committed
637
        "//tensorflow",
638
        "//tensorflow/python:platform",
639
640
641
642
643
644
645
646
647
648
649
650
651
    ],
)

py_test(
    name = "export_inference_graph_test",
    size = "medium",
    srcs = ["export_inference_graph_test.py"],
    srcs_version = "PY2AND3",
    tags = [
        "manual",
    ],
    deps = [
        ":export_inference_graph",
Derek Chow's avatar
Derek Chow committed
652
        "//tensorflow",
653
        "//tensorflow/python:platform",
654
655
    ],
)