Skip to content

Commit

Permalink
Full code refactor and added all networks
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Silberman committed Aug 30, 2016
1 parent bc0a0a8 commit 65fad62
Show file tree
Hide file tree
Showing 56 changed files with 8,060 additions and 818 deletions.
258 changes: 224 additions & 34 deletions slim/BUILD
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
# Description:
# Contains files for loading, training and evaluating TF-Slim 2.0-based models.
# Contains files for loading, training and evaluating TF-Slim-based models.

package(default_visibility = [":internal"])

licenses(["notice"]) # Apache 2.0

exports_files(["LICENSE"])

package_group(
name = "internal",
packages = ["//slim/"],
)
package_group(name = "internal")

py_library(
name = "dataset_utils",
srcs = ["datasets/dataset_utils.py"],
)

py_binary(
py_library(
name = "download_and_convert_cifar10",
srcs = ["datasets/download_and_convert_cifar10.py"],
deps = [":dataset_utils"],
)

py_binary(
py_library(
name = "download_and_convert_flowers",
srcs = ["datasets/download_and_convert_flowers.py"],
deps = [":dataset_utils"],
)

py_binary(
py_library(
name = "download_and_convert_mnist",
srcs = ["datasets/download_and_convert_mnist.py"],
deps = [":dataset_utils"],
)

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",
],
)

py_binary(
name = "cifar10",
srcs = ["datasets/cifar10.py"],
Expand Down Expand Up @@ -70,78 +77,261 @@ py_library(
],
)

py_binary(
name = "eval",
srcs = ["eval.py"],
deps = [
":dataset_factory",
":model_deploy",
":model_factory",
":preprocessing_factory",
],
)

py_library(
name = "model_deploy",
srcs = ["models/model_deploy.py"],
srcs = ["deployment/model_deploy.py"],
)

py_test(
name = "model_deploy_test",
srcs = ["models/model_deploy_test.py"],
srcs = ["deployment/model_deploy_test.py"],
srcs_version = "PY2AND3",
deps = [":model_deploy"],
)

py_library(
name = "cifar10_preprocessing",
srcs = ["models/cifar10_preprocessing.py"],
name = "cifarnet_preprocessing",
srcs = ["preprocessing/cifarnet_preprocessing.py"],
)

py_library(
name = "inception_preprocessing",
srcs = ["models/inception_preprocessing.py"],
srcs = ["preprocessing/inception_preprocessing.py"],
)

py_library(
name = "lenet_preprocessing",
srcs = ["models/lenet_preprocessing.py"],
srcs = ["preprocessing/lenet_preprocessing.py"],
)

py_library(
name = "vgg_preprocessing",
srcs = ["models/vgg_preprocessing.py"],
srcs = ["preprocessing/vgg_preprocessing.py"],
)

py_library(
name = "preprocessing_factory",
srcs = ["models/preprocessing_factory.py"],
srcs = ["preprocessing/preprocessing_factory.py"],
deps = [
":cifar10_preprocessing",
":cifarnet_preprocessing",
":inception_preprocessing",
":lenet_preprocessing",
":vgg_preprocessing",
],
)

# Typical networks definitions.

py_library(
name = "nets",
deps = [
":alexnet",
":cifarnet",
":inception",
":lenet",
":overfeat",
":resnet_v1",
":resnet_v2",
":vgg",
],
)

py_library(
name = "alexnet",
srcs = ["nets/alexnet.py"],
srcs_version = "PY2AND3",
)

py_test(
name = "alexnet_test",
size = "medium",
srcs = ["nets/alexnet_test.py"],
srcs_version = "PY2AND3",
deps = [":alexnet"],
)

py_library(
name = "cifarnet",
srcs = ["nets/cifarnet.py"],
)

py_library(
name = "inception",
srcs = ["nets/inception.py"],
srcs_version = "PY2AND3",
deps = [
":inception_resnet_v2",
":inception_v1",
":inception_v2",
":inception_v3",
],
)

py_library(
name = "inception_v1",
srcs = ["nets/inception_v1.py"],
srcs_version = "PY2AND3",
)

py_library(
name = "inception_v2",
srcs = ["nets/inception_v2.py"],
srcs_version = "PY2AND3",
)

py_library(
name = "inception_v3",
srcs = ["nets/inception_v3.py"],
srcs_version = "PY2AND3",
)

py_library(
name = "inception_resnet_v2",
srcs = ["nets/inception_resnet_v2.py"],
srcs_version = "PY2AND3",
)

py_test(
name = "inception_v1_test",
size = "large",
srcs = ["nets/inception_v1_test.py"],
shard_count = 3,
srcs_version = "PY2AND3",
deps = [":inception"],
)

py_test(
name = "inception_v2_test",
size = "large",
srcs = ["nets/inception_v2_test.py"],
shard_count = 3,
srcs_version = "PY2AND3",
deps = [":inception"],
)

py_test(
name = "inception_v3_test",
size = "large",
srcs = ["nets/inception_v3_test.py"],
shard_count = 3,
srcs_version = "PY2AND3",
deps = [":inception"],
)

py_test(
name = "inception_resnet_v2_test",
size = "large",
srcs = ["nets/inception_resnet_v2_test.py"],
shard_count = 3,
srcs_version = "PY2AND3",
deps = [":inception"],
)

py_library(
name = "lenet",
srcs = ["nets/lenet.py"],
)

py_library(
name = "model_factory",
srcs = ["models/model_factory.py"],
deps = [":lenet"],
name = "overfeat",
srcs = ["nets/overfeat.py"],
srcs_version = "PY2AND3",
)

py_test(
name = "overfeat_test",
size = "medium",
srcs = ["nets/overfeat_test.py"],
srcs_version = "PY2AND3",
deps = [":overfeat"],
)

py_library(
name = "resnet_utils",
srcs = ["nets/resnet_utils.py"],
srcs_version = "PY2AND3",
)

py_library(
name = "resnet_v1",
srcs = ["nets/resnet_v1.py"],
srcs_version = "PY2AND3",
deps = [
":resnet_utils",
],
)

py_test(
name = "resnet_v1_test",
size = "medium",
srcs = ["nets/resnet_v1_test.py"],
srcs_version = "PY2AND3",
deps = [":resnet_v1"],
)

py_library(
name = "resnet_v2",
srcs = ["nets/resnet_v2.py"],
srcs_version = "PY2AND3",
deps = [
":resnet_utils",
],
)

py_test(
name = "resnet_v2_test",
size = "medium",
srcs = ["nets/resnet_v2_test.py"],
srcs_version = "PY2AND3",
deps = [":resnet_v2"],
)

py_library(
name = "vgg",
srcs = ["nets/vgg.py"],
srcs_version = "PY2AND3",
)

py_test(
name = "vgg_test",
size = "medium",
srcs = ["nets/vgg_test.py"],
srcs_version = "PY2AND3",
deps = [":vgg"],
)

py_library(
name = "nets_factory",
srcs = ["nets/nets_factory.py"],
deps = [":nets"],
)

py_test(
name = "nets_factory_test",
size = "medium",
srcs = ["nets/nets_factory_test.py"],
srcs_version = "PY2AND3",
deps = [":nets_factory"],
)

py_binary(
name = "train_image_classifier",
srcs = ["train_image_classifier.py"],
deps = [
":dataset_factory",
":model_deploy",
":nets_factory",
":preprocessing_factory",
],
)

py_binary(
name = "train",
srcs = ["train.py"],
name = "eval_image_classifier",
srcs = ["eval_image_classifier.py"],
deps = [
":dataset_factory",
":model_deploy",
":model_factory",
":nets_factory",
":preprocessing_factory",
],
)
Loading

1 comment on commit 65fad62

@kuanghuei
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the sample script slim/scripts/finetune_inception_v3_on_flowers.sh, I see --learning_rate=0.0001 for the second part of training. However, in finetune_inception_v1_on_flowers.sh and finetune_resnet_v1_50_on_flowers.sh, it is 0.001 which makes more sense to me. Just wondering if this is a typo?

Please sign in to comment.