Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDATT2900 45b
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bård Sørensen Hestmark
IDATT2900 45b
Commits
709c0d30
Commit
709c0d30
authored
3 years ago
by
Bård Sørensen Hestmark
Browse files
Options
Downloads
Patches
Plain Diff
interactive run all models
parent
a6c3fe7a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
interactive_CA/interactive.py
+4
-4
4 additions, 4 deletions
interactive_CA/interactive.py
interactive_CA/main.py
+21
-16
21 additions, 16 deletions
interactive_CA/main.py
interactive_CA/run_all.py
+42
-0
42 additions, 0 deletions
interactive_CA/run_all.py
with
67 additions
and
20 deletions
interactive_CA/interactive.py
+
4
−
4
View file @
709c0d30
...
...
@@ -139,7 +139,7 @@ class Interactive:
if
counter
in
[
40
,
60
,
100
,
150
,
200
,
400
]:
self
.
save_cell
(
x_eval
,
cur_path
)
# Quadratic erasing at 51
#
el
if counter == 51:
# if counter == 51:
# # record loss before dmg
# before_loss = self.net.loss(x_eval, self.pad_target)
# # For lower half:
...
...
@@ -176,9 +176,9 @@ class Interactive:
image
=
np
.
asarray
(
Image
.
open
(
self
.
imgpath
))
self
.
game_update
(
surface
,
image
,
cellsize
)
time
.
sleep
(
0.00
)
# update delay
if
counter
==
2000
:
counter
+=
1
pygame
.
display
.
update
()
if
counter
==
400
:
print
(
'
Reached 400 iterations. Shutting down...
'
)
pygame
.
quit
()
sys
.
exit
()
counter
+=
1
pygame
.
display
.
update
()
This diff is collapsed.
Click to expand it.
interactive_CA/main.py
+
21
−
16
View file @
709c0d30
...
...
@@ -29,7 +29,7 @@ adam_sample_models = [
es_nonsample_models
=
[
[
'
final_models
\\
ES
\\
NonSamplePools
\\
9-CARROT-train_05-05-2022_09-14-06
\\
models
\\
model_2212000
'
,
'
🥕
'
,
9
,
True
],
[
'
final_models
\\
ES
\\
NonSamplePools
\\
9-RABBIT FACE-train_06-05-2022_12-18-56
\\
models
\\
model_1999000
'
,
'
🐰
'
,
9
,
True
],
[
'
final_models
\\
ES
\\
NonSamplePools
\\
9-RABBIT FACE-train_06-05-2022_12-18-56
\\
models
\\
model_1999000
'
,
'
🐰
'
,
9
,
True
],
[
'
final_models
\\
ES
\\
NonSamplePools
\\
15-CARROT-train_06-05-2022_11-06-58
\\
models
\\
model_1999000
'
,
'
🥕
'
,
15
,
True
],
[
'
final_models
\\
ES
\\
NonSamplePools
\\
15-RABBIT FACE-train_06-05-2022_12-21-00
\\
models
\\
model_1999000
'
,
'
🐰
'
,
15
,
True
]
]
...
...
@@ -46,49 +46,54 @@ models = [adam_nonsample_models, adam_sample_models,
if
__name__
==
'
__main__
'
:
# pick model [Index of model types][index of 9x9 or 15x15 rabbit or carrot]
model
=
models
[
1
][
2
]
# change only this or size
#
model = models[1][2] # change only this or size
# Auto determined
load_model
=
model
[
0
]
emoji
=
model
[
1
]
emoji_size
=
model
[
2
]
# size of training image usually 9 or 15
es
=
model
[
3
]
#
load_model = model[0]
#
emoji = model[1]
#
emoji_size = model[2] # size of training image usually 9 or 15
#
es = model[3]
# canvas size
size
=
emoji_size
#
size = emoji_size
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
-i
"
,
"
--img
"
,
type
=
str
,
default
=
emoji
,
parser
.
add_argument
(
"
-i
"
,
"
--img
"
,
type
=
str
,
default
=
''
,
metavar
=
"
🐰
"
,
help
=
"
The emoji to train on
"
)
parser
.
add_argument
(
"
-s
"
,
"
--size
"
,
type
=
int
,
default
=
size
,
help
=
"
Image size
"
)
default
=
9
,
help
=
"
Image size
"
)
parser
.
add_argument
(
"
--logdir
"
,
type
=
str
,
default
=
"
interactive_CA/logs
"
,
help
=
"
Logging folder for new model
"
)
parser
.
add_argument
(
"
-l
"
,
"
--load_model_path
"
,
type
=
str
,
default
=
load_model
,
help
=
"
Path to pre trained model
"
)
default
=
''
,
help
=
"
Path to pre trained model
"
)
parser
.
add_argument
(
"
--n_channels
"
,
type
=
int
,
default
=
16
,
help
=
"
Number of channels of the input tensor
"
)
parser
.
add_argument
(
"
--hidden_size
"
,
type
=
int
,
default
=
32
,
help
=
"
Number of hidden channels
"
)
parser
.
add_argument
(
"
--fire_rate
"
,
type
=
float
,
default
=
0.5
,
metavar
=
0.5
,
help
=
"
Cell fire rate
"
)
parser
.
add_argument
(
"
--es
"
,
type
=
bool
,
default
=
es
,
parser
.
add_argument
(
"
-e
"
,
"
--es
"
,
type
=
str
,
default
=
''
,
metavar
=
True
,
help
=
"
ES or adam
"
)
parser
.
add_argument
(
"
--eps
"
,
type
=
float
,
default
=
0.007
,
help
=
"
Epsilon scales the amount of damage done from adversarial attacks
"
)
args
=
parser
.
parse_args
()
args
.
emoji_size
=
emoji_
size
args
.
emoji_size
=
args
.
size
if
not
os
.
path
.
isdir
(
args
.
logdir
):
raise
Exception
(
"
Logging directory
'
%s
'
not found in base folder
"
%
args
.
logdir
)
match
es
:
case
True
:
method
=
'
ES
'
case
False
:
method
=
'
ADAM
'
match
args
.
es
:
case
'
True
'
:
method
=
'
ES
'
args
.
es
=
True
case
'
False
'
:
method
=
'
ADAM
'
args
.
es
=
False
args
.
logdir
=
"
%s/%s-%s-%s_%s
"
%
(
args
.
logdir
,
emoji_size
,
method
,
args
.
logdir
=
"
%s/%s-%s-%s_%s
"
%
(
args
.
logdir
,
args
.
emoji_size
,
method
,
unicodedata
.
name
(
args
.
img
),
time
.
strftime
(
"
%d-%m-%Y_%H-%M-%S
"
))
os
.
mkdir
(
args
.
logdir
)
...
...
This diff is collapsed.
Click to expand it.
interactive_CA/run_all.py
0 → 100644
+
42
−
0
View file @
709c0d30
import
subprocess
adam_nonsample_models
=
[
[
'
final_models
\\
Adam
\\
NonSamplePools
\\
9-CARROT-train_05-05-2022_17-55-17
\\
models
\\
model_19500.pt
'
,
'
🥕
'
,
9
,
False
],
[
'
final_models
\\
Adam
\\
NonSamplePools
\\
9-RABBIT-FACE-train_05-05-2022_16-07-21
\\
models
\\
model_19500.pt
'
,
'
🐰
'
,
9
,
False
],
[
'
final_models
\\
Adam
\\
NonSamplePools
\\
15-CARROT-train_05-05-2022_17-31-03
\\
models
\\
model_19500.pt
'
,
'
🥕
'
,
15
,
False
],
[
'
final_models
\\
Adam
\\
NonSamplePools
\\
15-RABBIT-FACE-train_05-05-2022_14-39-24
\\
models
\\
model_19500.pt
'
,
'
🐰
'
,
15
,
False
]
]
adam_sample_models
=
[
[
'
final_models
\\
Adam
\\
SamplePools
\\
9-CARROT-train_05-05-2022_17-04-48
\\
models
\\
model_19500.pt
'
,
'
🥕
'
,
9
,
False
],
[
'
final_models
\\
Adam
\\
SamplePools
\\
9-RABBIT-FACE-train_05-05-2022_11-43-14
\\
models
\\
model_19500.pt
'
,
'
🐰
'
,
9
,
False
],
[
'
final_models
\\
Adam
\\
SamplePools
\\
15-CARROT-train_05-05-2022_17-00-31
\\
models
\\
model_19500.pt
'
,
'
🥕
'
,
15
,
False
],
[
'
final_models
\\
Adam
\\
SamplePools
\\
15-RABBIT-FACE-train_05-05-2022_13-44-43
\\
models
\\
model_19500.pt
'
,
'
🐰
'
,
15
,
False
]
]
es_nonsample_models
=
[
[
'
final_models
\\
ES
\\
NonSamplePools
\\
9-CARROT-train_05-05-2022_09-14-06
\\
models
\\
model_2212000
'
,
'
🥕
'
,
9
,
True
],
[
'
final_models
\\
ES
\\
NonSamplePools
\\
9-RABBIT-FACE-train_06-05-2022_12-18-56
\\
models
\\
model_1999000
'
,
'
🐰
'
,
9
,
True
],
[
'
final_models
\\
ES
\\
NonSamplePools
\\
15-CARROT-train_06-05-2022_11-06-58
\\
models
\\
model_1999000
'
,
'
🥕
'
,
15
,
True
],
[
'
final_models
\\
ES
\\
NonSamplePools
\\
15-RABBIT-FACE-train_06-05-2022_12-21-00
\\
models
\\
model_1999000
'
,
'
🐰
'
,
15
,
True
]
]
es_sample_models
=
[
[
'
final_models
\\
ES
\\
SamplePools
\\
9-CARROT-train_29-04-2022_11-33-16
\\
models
\\
model_1036000
'
,
'
🥕
'
,
9
,
True
],
[
'
final_models
\\
ES
\\
SamplePools
\\
9-RABBIT-FACE-train_01-05-2022_10-32-24
\\
models
\\
model_1157000
'
,
'
🐰
'
,
9
,
True
],
[
'
final_models
\\
ES
\\
SamplePools
\\
15-CARROT-train_29-04-2022_11-18-06
\\
models
\\
model_1105000
'
,
'
🥕
'
,
15
,
True
],
[
'
final_models
\\
ES
\\
SamplePools
\\
15-RABBIT-FACE-train_01-05-2022_10-32-40
\\
models
\\
model_1126000
'
,
'
🐰
'
,
15
,
True
]
]
models
=
[
adam_nonsample_models
,
adam_sample_models
,
es_nonsample_models
,
es_sample_models
]
if
__name__
==
'
__main__
'
:
for
i
in
models
:
for
model
in
i
:
load_model
=
model
[
0
]
emoji
=
model
[
1
]
size
=
model
[
2
]
es
=
model
[
3
]
command
=
"
python .\interactive_CA\main.py -i %s -s %i -l %s -e %r
"
%
(
emoji
,
size
,
load_model
,
es
)
subprocess
.
run
(
command
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Bård Sørensen Hestmark
@baardshe
mentioned in commit
802e3fb7
·
2 years ago
mentioned in commit
802e3fb7
mentioned in commit 802e3fb7604867da4e23d645631946dcd0b76fdb
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment