Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ines Filipa Fernandes Ramos
inception_loop_asari_lab
Commits
3216706a
Commit
3216706a
authored
Apr 15, 2021
by
Ines Filipa Fernandes Ramos
Browse files
optimization of LN model and simple CNN
parent
cad60d6c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
RGC_simulations/LNModel.ipynb
View file @
3216706a
This diff is collapsed.
Click to expand it.
RGC_simulations/MEI.py
View file @
3216706a
...
...
@@ -285,14 +285,14 @@ def deepdraw(net, base_img, octaves, random_crop=True, original_size=None,
# stopping iterations if mean activation of net declines for generated image
mean_activation
=
net
(
src
).
mean
()
if
i
>
1
and
mean_activation
<=
mean_activation_hist
:
image
=
image_hist
break
else
:
image_hist
=
image
mean_activation_hist
=
net
(
src
).
mean
()
continue
#
mean_activation = net(src).mean()
#
if i>1 and mean_activation <= mean_activation_hist:
#
image = image_hist
#
break
#
else:
#
image_hist = image
#
mean_activation_hist = net(src).mean()
#
continue
# returning the resulting image
return
unprocess
(
image
,
mu
=
bias
,
sigma
=
scale
)
...
...
@@ -344,7 +344,7 @@ def contrast_tuning(model, img, bias, scale, min_contrast=0.01, n=1000, linear=T
return
cont
,
vals
,
lim_contrast
def
MEI_multi_seed
(
dataset_name
,
dat
,
dataloaders
,
models
,
n_seeds
,
MEIParameter
,
TargetUnit
,
bk_color
,
track
=
False
):
def
MEI_multi_seed
(
dataset_name
,
dat
,
dataloaders
,
models
,
n_seeds
,
MEIParameter
,
TargetUnit
,
bk_color
,
init_gen_image
,
track
=
False
):
"""
dataset_name : string # string with dataset_name of dataset used for training
dat : object # FileTreeDataset object with data schema of data
...
...
@@ -399,7 +399,10 @@ def MEI_multi_seed(dataset_name, dat, dataloaders, models, n_seeds, MEIParameter
# the background color of the initial image
background_color
=
np
.
float32
([
bk_color
]
*
channels
)
# generate initial random image
gen_image
=
np
.
random
.
normal
(
background_color
,
8
,
(
original_h
,
original_w
,
channels
))
if
init_gen_image
is
not
None
:
gen_image
=
init_gen_image
else
:
gen_image
=
np
.
random
.
normal
(
background_color
,
8
,
(
original_h
,
original_w
,
channels
))
gen_image
=
np
.
clip
(
gen_image
,
0
,
255
)
# generate class visualization via octavewise gradient ascent
...
...
RGC_simulations/example_notebook_RGC_sim.ipynb
View file @
3216706a
This diff is collapsed.
Click to expand it.
RGC_simulations/notebook_simple_CNN_RGC_sim.ipynb
View file @
3216706a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment