This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
79 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2018 The Lucid Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
|
||
from __future__ import absolute_import, division, print_function | ||
from lucid.modelzoo.vision_base import Model, IMAGENET_MEAN_BGR | ||
|
||
|
||
class AlexNet(Model): | ||
"""Original AlexNet weights ported to TF. | ||
AlexNet is the breakthrough vision model from Krizhevsky, et al (2012): | ||
https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf | ||
This implementation is a caffe re-implementation: | ||
http://www.cs.toronto.edu/~guerzhoy/tf_alexnet/ | ||
It was converted to TensorFlow by this GitHub project: | ||
https://github.com/huanzhang12/tensorflow-alexnet-model | ||
It appears the parameters are the actual original parameters. | ||
""" | ||
|
||
# The authors of code to convert AlexNet to TF host weights at | ||
# http://jaina.cs.ucdavis.edu/datasets/adv/imagenet/alexnet_frozen.pb | ||
# but it seems more polite and reliable to host our own. | ||
model_path = 'gs://modelzoo/vision/other_models/AlexNet.pb' | ||
labels_path = 'gs://modelzoo/labels/ImageNet_standard.txt' | ||
dataset = 'ImageNet' | ||
image_shape = [227, 227, 3] | ||
is_BGR = True | ||
image_value_range = (-IMAGENET_MEAN_BGR, 255-IMAGENET_MEAN_BGR) | ||
input_name = 'Placeholder' | ||
|
||
# TODO - Sanity check this graph and layers | ||
layers = [ | ||
{'type': 'conv', 'name': 'concat_2', 'size': 256}, | ||
{'type': 'conv', 'name': 'conv5_1', 'size': 256}, | ||
{'type': 'dense', 'name': 'Relu', 'size': 4096}, | ||
{'type': 'dense', 'name': 'Relu_1', 'size': 4096}, | ||
{'type': 'dense', 'name': 'Softmax', 'size': 1000}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters