Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PySegCNN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
earth_observation_public
PySegCNN
Commits
6741f907
Commit
6741f907
authored
4 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Reordered the inputs to each configuration dictionary
parent
0e3571eb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pysegcnn/main/config.py
+35
-43
35 additions, 43 deletions
pysegcnn/main/config.py
with
35 additions
and
43 deletions
pysegcnn/main/config.py
+
35
−
43
View file @
6741f907
...
...
@@ -11,13 +11,7 @@ Modify the variable values to your needs, but DO NOT modify the variable names.
# builtins
import
os
# externals
import
torch.nn
as
nn
import
torch.optim
as
optim
# locals
from
pysegcnn.core.models
import
UNet
from
pysegcnn.core.transforms
import
Augment
,
FlipLr
,
FlipUd
,
Noise
# from pysegcnn.core.transforms import Augment, FlipLr, FlipUd, Noise
# path to this file
HERE
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
...
...
@@ -59,6 +53,11 @@ dataset_config = {
# tiles of size (tile_size, tile_size)
'
pad
'
:
True
,
# set random seed for reproducibility of the training, validation
# and test data split
# used if split_mode='random' and split_mode='scene'
'
seed
'
:
0
,
# the constant value to pad around the ground truth mask if pad=True
'
cval
'
:
99
,
...
...
@@ -132,11 +131,6 @@ split_config = {
# the date build the validation set, the test set is empty
'
split_mode
'
:
'
scene
'
,
# set random seed for reproducibility of the training, validation
# and test data split
# used if split_mode='random' and split_mode='scene'
'
seed
'
:
0
,
# (ttratio * 100) % of the dataset will be used for training and
# validation
# used if split_mode='random' and split_mode='scene'
...
...
@@ -155,6 +149,15 @@ split_config = {
'
date
'
:
'
yyyymmdd
'
,
'
dateformat
'
:
'
%Y%m%d
'
,
# whether to drop samples (during training only) with a fraction of
# pixels equal to the constant padding value cval >= drop
# drop=1 means, do not use a sample if all pixels = cval
# drop=0.8 means, do not use a sample if 80% or more of the pixels are
# equal to cval
# drop=0.2 means, ...
# drop=0 means, do not drop any samples
'
drop
'
:
0
,
}
# the model configuration dictionary
...
...
@@ -165,7 +168,7 @@ model_config = {
# -------------------------------------------------------------------------
# define the model
'
model
'
:
UN
et
,
'
model
_name
'
:
'
Un
et
'
,
# define the number of filters for each convolutional layer
# the number of filters should increase with depth
...
...
@@ -181,16 +184,6 @@ model_config = {
'
dilation
'
:
1
# the field of view of the kernel
},
}
# the training configuration dictionary
training_config
=
{
# ----------------------------- Training ---------------------------------
# -------------------------------------------------------------------------
# path to save trained models
'
state_path
'
:
os
.
path
.
join
(
HERE
,
'
_models/
'
),
...
...
@@ -213,7 +206,22 @@ training_config = {
# Training ----------------------------------------------------------------
# whether to resume training from an existing model checkpoint
'
checkpoint
'
:
True
,
'
checkpoint
'
:
False
,
# define the batch size
# determines how many samples of the dataset are processed until the
# weights of the network are updated (via mini-batch gradient descent)
'
batch_size
'
:
64
}
# the training configuration dictionary
train_config
=
{
# ----------------------------- Training ---------------------------------
# -------------------------------------------------------------------------
# whether to early stop training if the accuracy on the validation set
# does not increase more than delta over patience epochs
...
...
@@ -222,31 +230,15 @@ training_config = {
'
delta
'
:
0
,
'
patience
'
:
10
,
# whether to drop samples (during training only) with a fraction of
# pixels equal to the constant padding value cval >= drop
# drop=1 means, do not use a sample if all pixels = cval
# drop=0.8 means, do not use a sample if 80% or more of the pixels are
# equal to cval
# drop=0.2 means, ...
'
drop
'
:
1
,
# define the batch size
# determines how many samples of the dataset are processed until the
# weights of the network are updated (via mini-batch gradient descent)
'
batch_size
'
:
64
,
# define the number of epochs: the number of maximum iterations over
# the whole training dataset
'
epochs
'
:
200
,
# define the number of threads
'
nthreads
'
:
os
.
cpu_count
(),
# define a loss function to calculate the network error
'
loss_
function
'
:
nn
.
CrossEntropy
Loss
()
,
'
loss_
name
'
:
'
CrossEntropy
'
,
# define an optimizer to update the network weights
'
optim
izer
'
:
optim
.
Adam
,
'
optim
_name
'
:
'
Adam
'
,
# define the learning rate
'
lr
'
:
0.001
,
...
...
@@ -301,5 +293,5 @@ evaluation_config = {
config
=
{
**
dataset_config
,
**
split_config
,
**
model_config
,
**
train
ing
_config
,
**
train_config
,
**
evaluation_config
}
This diff is collapsed.
Click to expand it.
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