Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do some minor formatting to apply PEP8 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions deepdreamer/deepdreamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@

def _select_network(netname):
if netname == 'bvlc_googlenet':
NET_FN = "deploy.prototxt" # Make sure force_backward: true
PARAM_FN = "bvlc_googlenet.caffemodel"
CHANNEL_SWAP = (2, 1, 0)
net_fn = "deploy.prototxt" # Make sure force_backward: true
param_fn = "bvlc_googlenet.caffemodel"
channel_swap = (2, 1, 0)
# ImageNet mean, training set dependent
CAFFE_MEAN = np.float32([104.0, 116.0, 122.0])
return NET_FN, PARAM_FN, CHANNEL_SWAP, CAFFE_MEAN
caffe_mean = np.float32([104.0, 116.0, 122.0])
return net_fn, param_fn, channel_swap, caffe_mean
elif netname == 'googlenet_place205':
# TODO: refit SWAP and MEAN for places205? These work for now.
NET_FN = "deploy_places205.protxt" # Make sure force_backward: true
PARAM_FN = "googlelet_places205_train_iter_2400000.caffemodel"
CHANNEL_SWAP = (2, 1, 0)
net_fn = "deploy_places205.protxt" # Make sure force_backward: true
param_fn = "googlelet_places205_train_iter_2400000.caffemodel"
channel_swap = (2, 1, 0)
# ImageNet mean, training set dependent
CAFFE_MEAN = np.float32([104.0, 116.0, 122.0])
return NET_FN, PARAM_FN, CHANNEL_SWAP, CAFFE_MEAN
caffe_mean = np.float32([104.0, 116.0, 122.0])
return net_fn, param_fn, channel_swap, caffe_mean
else:
print("Error: network {} not implemented".format(netname))

Expand Down Expand Up @@ -138,9 +138,9 @@ def _create_video(video, frame_rate=24):

def list_layers(network="bvlc_googlenet"):
# Load DNN model
NET_FN, PARAM_FN, CHANNEL_SWAP, CAFFE_MEAN = _select_network(network)
net_fn, param_fn, channel_swap, caffe_mean = _select_network(network)
net = Classifier(
NET_FN, PARAM_FN, mean=CAFFE_MEAN, channel_swap=CHANNEL_SWAP)
net_fn, param_fn, mean=caffe_mean, channel_swap=channel_swap)
net.blobs.keys()


Expand All @@ -159,9 +159,9 @@ def deepdream(
set_mode_gpu()

# Select, load DNN model
NET_FN, PARAM_FN, CHANNEL_SWAP, CAFFE_MEAN = _select_network(network)
net_fn, param_fn, channel_swap, caffe_mean = _select_network(network)
net = Classifier(
NET_FN, PARAM_FN, mean=CAFFE_MEAN, channel_swap=CHANNEL_SWAP)
net_fn, param_fn, mean=caffe_mean, channel_swap=channel_swap)

img_pool = [img_path]

Expand Down Expand Up @@ -205,9 +205,9 @@ def deepdream_video(
frame_rate=24):

# Select, load DNN model
NET_FN, PARAM_FN, CHANNEL_SWAP, CAFFE_MEAN = _select_network(network)
net_fn, param_fn, channel_swap, caffe_mean = _select_network(network)
net = Classifier(
NET_FN, PARAM_FN, mean=CAFFE_MEAN, channel_swap=CHANNEL_SWAP)
net_fn, param_fn, mean=caffe_mean, channel_swap=channel_swap)

print("Extracting video...")
_extract_video(video)
Expand Down