BUILD 13.2 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
    deps = [
16
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
17
    ],
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",
39
        # "//tensorflow",
derekjchow's avatar
derekjchow committed
40
41
42
    ],
)

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",
49
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
50
    ],
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
    deps = [
        ":dataset_utils",
58
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
59
    ],
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",
68
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
69
    ],
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
    deps = [
        ":dataset_utils",
88
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
89
    ],
90
91
92
93
94
)

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

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

py_binary(
    name = "mnist",
    srcs = ["datasets/mnist.py"],
Derek Chow's avatar
Derek Chow committed
113
114
    deps = [
        ":dataset_utils",
115
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
116
    ],
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
    deps = [
134
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
135
    ],
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",
145
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
146
    ],
147
148
149
)

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

py_library(
    name = "inception_preprocessing",
159
    srcs = ["preprocessing/inception_preprocessing.py"],
Derek Chow's avatar
Derek Chow committed
160
    deps = [
161
162
        # "//tensorflow",
        # "//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
    deps = [
170
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
171
    ],
172
173
174
175
)

py_library(
    name = "vgg_preprocessing",
176
    srcs = ["preprocessing/vgg_preprocessing.py"],
Derek Chow's avatar
Derek Chow committed
177
    deps = [
178
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
179
    ],
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",
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",
204
        ":mobilenet",
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 = [
pkulzc's avatar
pkulzc committed
219
        # "//tensorflow",
220
    ],
221
222
223
224
225
226
227
)

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

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

242
243
244
245
246
py_library(
    name = "cyclegan",
    srcs = ["nets/cyclegan.py"],
    deps = [
        # "//numpy",
247
        # "//tensorflow",
248
249
250
251
252
253
254
255
256
257
    ],
)

py_test(
    name = "cyclegan_test",
    srcs = ["nets/cyclegan_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
    deps = [
        ":cyclegan",
258
        # "//tensorflow",
259
260
261
262
263
264
265
    ],
)

py_library(
    name = "dcgan",
    srcs = ["nets/dcgan.py"],
    deps = [
266
        # "//tensorflow",
267
268
269
270
271
272
273
274
275
276
    ],
)

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

281
282
283
284
285
286
287
288
289
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
290
        ":inception_v4",
291
292
293
    ],
)

Alex Kurakin's avatar
Alex Kurakin committed
294
295
296
297
py_library(
    name = "inception_utils",
    srcs = ["nets/inception_utils.py"],
    srcs_version = "PY2AND3",
298
    deps = [
pkulzc's avatar
pkulzc committed
299
        # "//tensorflow",
300
    ],
Alex Kurakin's avatar
Alex Kurakin committed
301
302
)

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

py_library(
    name = "inception_v2",
    srcs = ["nets/inception_v2.py"],
    srcs_version = "PY2AND3",
Alex Kurakin's avatar
Alex Kurakin committed
317
318
    deps = [
        ":inception_utils",
319
        # "//tensorflow",
Alex Kurakin's avatar
Alex Kurakin committed
320
    ],
321
322
323
324
325
326
)

py_library(
    name = "inception_v3",
    srcs = ["nets/inception_v3.py"],
    srcs_version = "PY2AND3",
Alex Kurakin's avatar
Alex Kurakin committed
327
328
    deps = [
        ":inception_utils",
329
        # "//tensorflow",
Alex Kurakin's avatar
Alex Kurakin committed
330
331
332
333
334
335
336
337
338
    ],
)

py_library(
    name = "inception_v4",
    srcs = ["nets/inception_v4.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":inception_utils",
339
        # "//tensorflow",
Alex Kurakin's avatar
Alex Kurakin committed
340
    ],
341
342
343
344
345
346
)

py_library(
    name = "inception_resnet_v2",
    srcs = ["nets/inception_resnet_v2.py"],
    srcs_version = "PY2AND3",
347
    deps = [
pkulzc's avatar
pkulzc committed
348
        # "//tensorflow",
349
    ],
350
351
352
353
354
355
356
357
)

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
358
359
    deps = [
        ":inception",
360
        # "//numpy",
361
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
362
    ],
363
364
365
366
367
368
369
370
)

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
371
372
    deps = [
        ":inception",
373
        # "//numpy",
374
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
375
    ],
376
377
378
379
380
381
382
383
)

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
384
385
    deps = [
        ":inception",
386
        # "//numpy",
387
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
388
    ],
389
390
)

Alex Kurakin's avatar
Alex Kurakin committed
391
392
393
394
395
396
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
397
398
    deps = [
        ":inception",
399
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
400
    ],
Alex Kurakin's avatar
Alex Kurakin committed
401
402
)

403
404
405
406
407
408
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
409
410
    deps = [
        ":inception",
411
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
412
    ],
413
414
)

415
416
417
py_library(
    name = "lenet",
    srcs = ["nets/lenet.py"],
Derek Chow's avatar
Derek Chow committed
418
    deps = [
419
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
420
    ],
421
422
)

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

432
433
434
435
py_library(
    name = "mobilenet_v2",
    srcs = glob(["nets/mobilenet/*.py"]),
    srcs_version = "PY2AND3",
436
    deps = [
437
438
        "//third_party/py/contextlib2",
        # "//tensorflow",
439
440
441
    ],
)

442
443
444
445
446
447
448
449
450
451
452
453
py_test(
    name = "mobilenet_v2_test",
    srcs = ["nets/mobilenet/mobilenet_v2_test.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":mobilenet",
        # "//tensorflow",
    ],
)

py_library(
    name = "mobilenet",
454
455
    deps = [
        ":mobilenet_v1",
456
        ":mobilenet_v2",
457
458
459
    ],
)

andrewghoward's avatar
andrewghoward committed
460
461
462
463
464
465
466
467
py_test(
    name = "mobilenet_v1_test",
    size = "large",
    srcs = ["nets/mobilenet_v1_test.py"],
    shard_count = 3,
    srcs_version = "PY2AND3",
    deps = [
        ":mobilenet_v1",
468
        # "//numpy",
469
        # "//tensorflow",
470
471
472
    ],
)

473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
py_binary(
    name = "mobilenet_v1_train",
    srcs = ["nets/mobilenet_v1_train.py"],
    deps = [
        ":dataset_factory",
        ":mobilenet_v1",
        ":preprocessing_factory",
        # "//tensorflow",
    ],
)

py_binary(
    name = "mobilenet_v1_eval",
    srcs = ["nets/mobilenet_v1_eval.py"],
    deps = [
        ":dataset_factory",
        ":mobilenet_v1",
        ":preprocessing_factory",
        # "//tensorflow",
    ],
)

495
496
497
498
499
py_library(
    name = "nasnet_utils",
    srcs = ["nets/nasnet/nasnet_utils.py"],
    srcs_version = "PY2AND3",
    deps = [
500
        # "//tensorflow",
501
502
503
504
505
506
507
508
509
    ],
)

py_library(
    name = "nasnet",
    srcs = ["nets/nasnet/nasnet.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":nasnet_utils",
510
        # "//tensorflow",
511
512
513
514
515
516
517
518
519
520
    ],
)

py_test(
    name = "nasnet_utils_test",
    size = "medium",
    srcs = ["nets/nasnet/nasnet_utils_test.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":nasnet_utils",
521
        # "//tensorflow",
522
523
524
525
526
527
528
529
530
531
532
    ],
)

py_test(
    name = "nasnet_test",
    size = "large",
    srcs = ["nets/nasnet/nasnet_test.py"],
    shard_count = 10,
    srcs_version = "PY2AND3",
    deps = [
        ":nasnet",
533
        # "//tensorflow",
andrewghoward's avatar
andrewghoward committed
534
535
536
    ],
)

537
py_library(
538
539
540
    name = "overfeat",
    srcs = ["nets/overfeat.py"],
    srcs_version = "PY2AND3",
541
    deps = [
pkulzc's avatar
pkulzc committed
542
        # "//tensorflow",
543
    ],
544
545
546
547
548
549
550
)

py_test(
    name = "overfeat_test",
    size = "medium",
    srcs = ["nets/overfeat_test.py"],
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
551
552
    deps = [
        ":overfeat",
553
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
554
    ],
555
556
)

557
558
559
560
py_library(
    name = "pix2pix",
    srcs = ["nets/pix2pix.py"],
    srcs_version = "PY2AND3",
561
    deps = [
pkulzc's avatar
pkulzc committed
562
        # "//tensorflow",
563
    ],
564
565
566
567
568
569
570
571
)

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

576
577
578
579
py_library(
    name = "resnet_utils",
    srcs = ["nets/resnet_utils.py"],
    srcs_version = "PY2AND3",
580
    deps = [
pkulzc's avatar
pkulzc committed
581
        # "//tensorflow",
582
    ],
583
584
585
586
587
588
589
590
)

py_library(
    name = "resnet_v1",
    srcs = ["nets/resnet_v1.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":resnet_utils",
591
        # "//tensorflow",
592
593
594
595
596
597
598
    ],
)

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

py_library(
    name = "resnet_v2",
    srcs = ["nets/resnet_v2.py"],
    srcs_version = "PY2AND3",
    deps = [
        ":resnet_utils",
615
        # "//tensorflow",
616
617
618
619
620
621
622
    ],
)

py_test(
    name = "resnet_v2_test",
    size = "medium",
    srcs = ["nets/resnet_v2_test.py"],
Derek Chow's avatar
Derek Chow committed
623
    shard_count = 2,
624
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
625
    deps = [
626
        ":resnet_utils",
Derek Chow's avatar
Derek Chow committed
627
        ":resnet_v2",
628
        # "//numpy",
629
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
630
    ],
631
632
633
634
635
636
)

py_library(
    name = "vgg",
    srcs = ["nets/vgg.py"],
    srcs_version = "PY2AND3",
637
    deps = [
pkulzc's avatar
pkulzc committed
638
        # "//tensorflow",
639
    ],
640
641
642
643
644
645
646
)

py_test(
    name = "vgg_test",
    size = "medium",
    srcs = ["nets/vgg_test.py"],
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
647
648
    deps = [
        ":vgg",
649
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
650
    ],
651
652
653
654
655
)

py_library(
    name = "nets_factory",
    srcs = ["nets/nets_factory.py"],
Derek Chow's avatar
Derek Chow committed
656
657
    deps = [
        ":nets",
658
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
659
    ],
660
661
662
663
664
665
)

py_test(
    name = "nets_factory_test",
    size = "medium",
    srcs = ["nets/nets_factory_test.py"],
Derek Chow's avatar
Derek Chow committed
666
    shard_count = 2,
667
    srcs_version = "PY2AND3",
Derek Chow's avatar
Derek Chow committed
668
669
    deps = [
        ":nets_factory",
670
        # "//tensorflow",
Derek Chow's avatar
Derek Chow committed
671
    ],
672
673
674
675
676
)

py_binary(
    name = "train_image_classifier",
    srcs = ["train_image_classifier.py"],
pkulzc's avatar
pkulzc committed
677
    paropts = ["--compress"],
678
679
680
681
682
    deps = [
        ":dataset_factory",
        ":model_deploy",
        ":nets_factory",
        ":preprocessing_factory",
683
        # "//tensorflow",
684
    ],
685
686
687
)

py_binary(
688
689
    name = "eval_image_classifier",
    srcs = ["eval_image_classifier.py"],
690
691
    deps = [
        ":dataset_factory",
692
        ":nets_factory",
693
        ":preprocessing_factory",
694
        # "//tensorflow",
695
696
    ],
)
697
698
699
700

py_binary(
    name = "export_inference_graph",
    srcs = ["export_inference_graph.py"],
pkulzc's avatar
pkulzc committed
701
    paropts = ["--compress"],
702
703
704
    deps = [
        ":dataset_factory",
        ":nets_factory",
705
706
        # "//tensorflow",
        # "//tensorflow/python:platform",
707
708
709
710
711
712
713
714
715
716
717
718
719
    ],
)

py_test(
    name = "export_inference_graph_test",
    size = "medium",
    srcs = ["export_inference_graph_test.py"],
    srcs_version = "PY2AND3",
    tags = [
        "manual",
    ],
    deps = [
        ":export_inference_graph",
720
721
        # "//tensorflow",
        # "//tensorflow/python:platform",
722
723
    ],
)