This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 650
/
AlexNet.py
45 lines (39 loc) · 1.81 KB
/
AlexNet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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_caffe_Places365(Model):
"""AlexNet re-implementation trained on Places365.
This model is a reimplementation of AlexNet
https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf
trained on the MIT Places365 dataset, retrieved here:
https://github.com/CSAILVision/places365
and then ported to TensorFlow using caffe-tensorflow.
"""
model_path = 'gs://modelzoo/vision/caffe_models/AlexNet_places365.pb'
labels_path = 'gs://modelzoo/labels/Places365.txt'
dataset = 'Places365'
image_shape = [227, 227, 3]
is_BGR = True
image_value_range = (-IMAGENET_MEAN_BGR, 255-IMAGENET_MEAN_BGR)
input_name = 'input'
# TODO - Sanity check this graph and layers
layers = [
{'type': 'conv', 'name': 'conv5/concat', 'size': 256} ,
{'type': 'conv', 'name': 'conv5/conv5', 'size': 256} ,
{'type': 'dense', 'name': 'fc6/fc6', 'size': 4096} ,
{'type': 'dense', 'name': 'fc7/fc7', 'size': 4096} ,
{'type': 'dense', 'name': 'prob', 'size': 365} ,
]