Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
CNNArch2Caffe2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
monticore
EmbeddedMontiArc
generators
CNNArch2Caffe2
Commits
fad537a7
Commit
fad537a7
authored
Dec 13, 2018
by
Carlos Alfredo Yeverino Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected tests
parent
6f055b53
Pipeline
#90951
passed with stages
in 4 minutes and 48 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
src/test/resources/target_code/CNNCreator_Alexnet.py
src/test/resources/target_code/CNNCreator_Alexnet.py
+9
-2
src/test/resources/target_code/CNNCreator_CifarClassifierNetwork.py
...esources/target_code/CNNCreator_CifarClassifierNetwork.py
+9
-2
src/test/resources/target_code/CNNCreator_VGG16.py
src/test/resources/target_code/CNNCreator_VGG16.py
+9
-2
No files found.
src/test/resources/target_code/CNNCreator_Alexnet.py
View file @
fad537a7
...
...
@@ -30,6 +30,13 @@ class CNNCreator_Alexnet:
def
add_input
(
self
,
model
,
batch_size
,
db
,
db_type
,
device_opts
):
with
core
.
DeviceScope
(
device_opts
):
if
not
os
.
path
.
isdir
(
db
):
logging
.
error
(
"Data loading failure. Directory '"
+
os
.
path
.
abspath
(
db
)
+
"' does not exist."
)
sys
.
exit
(
1
)
elif
not
(
os
.
path
.
isfile
(
os
.
path
.
join
(
db
,
'data.mdb'
))
and
os
.
path
.
isfile
(
os
.
path
.
join
(
db
,
'lock.mdb'
))):
logging
.
error
(
"Data loading failure. Directory '"
+
os
.
path
.
abspath
(
db
)
+
"' does not contain lmdb files."
)
sys
.
exit
(
1
)
# load the data
data_uint8
,
label
=
brew
.
db_input
(
model
,
...
...
@@ -202,7 +209,7 @@ class CNNCreator_Alexnet:
arg_scope
=
{
"order"
:
"NCHW"
}
# == Training model ==
train_model
=
model_helper
.
ModelHelper
(
name
=
"train_net"
,
arg_scope
=
arg_scope
)
data
,
label
,
train_dataset_size
=
self
.
add_input
(
train_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
mnist-train-nchw-
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
data
,
label
,
train_dataset_size
=
self
.
add_input
(
train_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
train_
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
predictions
=
self
.
create_model
(
train_model
,
data
,
device_opts
=
device_opts
)
self
.
add_training_operators
(
train_model
,
predictions
,
label
,
device_opts
,
opt_type
,
base_learning_rate
,
policy
,
stepsize
,
epsilon
,
beta1
,
beta2
,
gamma
,
momentum
)
self
.
add_accuracy
(
train_model
,
predictions
,
label
,
device_opts
,
eval_metric
)
...
...
@@ -225,7 +232,7 @@ class CNNCreator_Alexnet:
print
(
"== Running Test model =="
)
# == Testing model. ==
test_model
=
model_helper
.
ModelHelper
(
name
=
"test_net"
,
arg_scope
=
arg_scope
,
init_params
=
False
)
data
,
label
,
test_dataset_size
=
self
.
add_input
(
test_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
mnist-test-nchw-
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
data
,
label
,
test_dataset_size
=
self
.
add_input
(
test_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
test_
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
predictions
=
self
.
create_model
(
test_model
,
data
,
device_opts
=
device_opts
)
self
.
add_accuracy
(
test_model
,
predictions
,
label
,
device_opts
,
eval_metric
)
workspace
.
RunNetOnce
(
test_model
.
param_init_net
)
...
...
src/test/resources/target_code/CNNCreator_CifarClassifierNetwork.py
View file @
fad537a7
...
...
@@ -30,6 +30,13 @@ class CNNCreator_CifarClassifierNetwork:
def
add_input
(
self
,
model
,
batch_size
,
db
,
db_type
,
device_opts
):
with
core
.
DeviceScope
(
device_opts
):
if
not
os
.
path
.
isdir
(
db
):
logging
.
error
(
"Data loading failure. Directory '"
+
os
.
path
.
abspath
(
db
)
+
"' does not exist."
)
sys
.
exit
(
1
)
elif
not
(
os
.
path
.
isfile
(
os
.
path
.
join
(
db
,
'data.mdb'
))
and
os
.
path
.
isfile
(
os
.
path
.
join
(
db
,
'lock.mdb'
))):
logging
.
error
(
"Data loading failure. Directory '"
+
os
.
path
.
abspath
(
db
)
+
"' does not contain lmdb files."
)
sys
.
exit
(
1
)
# load the data
data_uint8
,
label
=
brew
.
db_input
(
model
,
...
...
@@ -287,7 +294,7 @@ class CNNCreator_CifarClassifierNetwork:
arg_scope
=
{
"order"
:
"NCHW"
}
# == Training model ==
train_model
=
model_helper
.
ModelHelper
(
name
=
"train_net"
,
arg_scope
=
arg_scope
)
data
,
label
,
train_dataset_size
=
self
.
add_input
(
train_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
mnist-train-nchw-
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
data
,
label
,
train_dataset_size
=
self
.
add_input
(
train_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
train_
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
softmax
=
self
.
create_model
(
train_model
,
data
,
device_opts
=
device_opts
)
self
.
add_training_operators
(
train_model
,
softmax
,
label
,
device_opts
,
opt_type
,
base_learning_rate
,
policy
,
stepsize
,
epsilon
,
beta1
,
beta2
,
gamma
,
momentum
)
self
.
add_accuracy
(
train_model
,
softmax
,
label
,
device_opts
,
eval_metric
)
...
...
@@ -310,7 +317,7 @@ class CNNCreator_CifarClassifierNetwork:
print
(
"== Running Test model =="
)
# == Testing model. ==
test_model
=
model_helper
.
ModelHelper
(
name
=
"test_net"
,
arg_scope
=
arg_scope
,
init_params
=
False
)
data
,
label
,
test_dataset_size
=
self
.
add_input
(
test_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
mnist-test-nchw-
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
data
,
label
,
test_dataset_size
=
self
.
add_input
(
test_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
test_
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
softmax
=
self
.
create_model
(
test_model
,
data
,
device_opts
=
device_opts
)
self
.
add_accuracy
(
test_model
,
predictions
,
label
,
device_opts
,
eval_metric
)
workspace
.
RunNetOnce
(
test_model
.
param_init_net
)
...
...
src/test/resources/target_code/CNNCreator_VGG16.py
View file @
fad537a7
...
...
@@ -30,6 +30,13 @@ class CNNCreator_VGG16:
def
add_input
(
self
,
model
,
batch_size
,
db
,
db_type
,
device_opts
):
with
core
.
DeviceScope
(
device_opts
):
if
not
os
.
path
.
isdir
(
db
):
logging
.
error
(
"Data loading failure. Directory '"
+
os
.
path
.
abspath
(
db
)
+
"' does not exist."
)
sys
.
exit
(
1
)
elif
not
(
os
.
path
.
isfile
(
os
.
path
.
join
(
db
,
'data.mdb'
))
and
os
.
path
.
isfile
(
os
.
path
.
join
(
db
,
'lock.mdb'
))):
logging
.
error
(
"Data loading failure. Directory '"
+
os
.
path
.
abspath
(
db
)
+
"' does not contain lmdb files."
)
sys
.
exit
(
1
)
# load the data
data_uint8
,
label
=
brew
.
db_input
(
model
,
...
...
@@ -177,7 +184,7 @@ class CNNCreator_VGG16:
arg_scope
=
{
"order"
:
"NCHW"
}
# == Training model ==
train_model
=
model_helper
.
ModelHelper
(
name
=
"train_net"
,
arg_scope
=
arg_scope
)
data
,
label
,
train_dataset_size
=
self
.
add_input
(
train_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
mnist-train-nchw-
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
data
,
label
,
train_dataset_size
=
self
.
add_input
(
train_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
train_
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
predictions
=
self
.
create_model
(
train_model
,
data
,
device_opts
=
device_opts
)
self
.
add_training_operators
(
train_model
,
predictions
,
label
,
device_opts
,
opt_type
,
base_learning_rate
,
policy
,
stepsize
,
epsilon
,
beta1
,
beta2
,
gamma
,
momentum
)
self
.
add_accuracy
(
train_model
,
predictions
,
label
,
device_opts
,
eval_metric
)
...
...
@@ -200,7 +207,7 @@ class CNNCreator_VGG16:
print
(
"== Running Test model =="
)
# == Testing model. ==
test_model
=
model_helper
.
ModelHelper
(
name
=
"test_net"
,
arg_scope
=
arg_scope
,
init_params
=
False
)
data
,
label
,
test_dataset_size
=
self
.
add_input
(
test_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
mnist-test-nchw-
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
data
,
label
,
test_dataset_size
=
self
.
add_input
(
test_model
,
batch_size
=
batch_size
,
db
=
os
.
path
.
join
(
self
.
_data_dir_
,
'
test_
lmdb'
),
db_type
=
'lmdb'
,
device_opts
=
device_opts
)
predictions
=
self
.
create_model
(
test_model
,
data
,
device_opts
=
device_opts
)
self
.
add_accuracy
(
test_model
,
predictions
,
label
,
device_opts
,
eval_metric
)
workspace
.
RunNetOnce
(
test_model
.
param_init_net
)
...
...
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