Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
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
Tom Rink
python
Commits
35e254c3
Commit
35e254c3
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
minor...
parent
afa0d82e
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
modules/deeplearning/unet.py
+30
-30
30 additions, 30 deletions
modules/deeplearning/unet.py
with
30 additions
and
30 deletions
modules/deeplearning/unet.py
+
30
−
30
View file @
35e254c3
...
@@ -309,35 +309,35 @@ class UNET:
...
@@ -309,35 +309,35 @@ class UNET:
dataset
=
dataset
.
map
(
self
.
data_function_evaluate
,
num_parallel_calls
=
8
)
dataset
=
dataset
.
map
(
self
.
data_function_evaluate
,
num_parallel_calls
=
8
)
self
.
eval_dataset
=
dataset
self
.
eval_dataset
=
dataset
def
setup_pipeline
(
self
,
data_nda
,
label_nda
,
perc
=
0.20
):
#
def setup_pipeline(self, data_nda, label_nda, perc=0.20):
#
num_samples
=
data_nda
.
shape
[
0
]
#
num_samples = data_nda.shape[0]
num_test
=
int
(
num_samples
*
perc
)
#
num_test = int(num_samples * perc)
self
.
num_data_samples
=
num_samples
-
num_test
#
self.num_data_samples = num_samples - num_test
num_train
=
self
.
num_data_samples
#
num_train = self.num_data_samples
#
self
.
train_data_nda
=
data_nda
[
0
:
num_train
]
#
self.train_data_nda = data_nda[0:num_train]
self
.
train_label_nda
=
label_nda
[
0
:
num_train
]
#
self.train_label_nda = label_nda[0:num_train]
self
.
test_data_nda
=
data_nda
[
num_train
:]
#
self.test_data_nda = data_nda[num_train:]
self
.
test_label_nda
=
label_nda
[
num_train
:]
#
self.test_label_nda = label_nda[num_train:]
#
trn_idxs
=
np
.
arange
(
self
.
train_data_nda
.
shape
[
0
])
#
trn_idxs = np.arange(self.train_data_nda.shape[0])
tst_idxs
=
np
.
arange
(
self
.
test_data_nda
.
shape
[
0
])
#
tst_idxs = np.arange(self.test_data_nda.shape[0])
#
np
.
random
.
shuffle
(
tst_idxs
)
#
np.random.shuffle(tst_idxs)
#
self
.
get_train_dataset
(
trn_idxs
)
#
self.get_train_dataset(trn_idxs)
self
.
get_test_dataset
(
tst_idxs
)
#
self.get_test_dataset(tst_idxs)
#
print
(
'
datetime:
'
,
now
)
#
print('datetime: ', now)
print
(
'
training and test data:
'
)
#
print('training and test data: ')
print
(
'
---------------------------
'
)
#
print('---------------------------')
print
(
'
num train samples:
'
,
self
.
num_data_samples
)
#
print('num train samples: ', self.num_data_samples)
print
(
'
BATCH SIZE:
'
,
BATCH_SIZE
)
#
print('BATCH SIZE: ', BATCH_SIZE)
print
(
'
num test samples:
'
,
tst_idxs
.
shape
[
0
])
#
print('num test samples: ', tst_idxs.shape[0])
print
(
'
setup_pipeline: Done
'
)
#
print('setup_pipeline: Done')
def
setup_pipeline
_files
(
self
,
data_files
,
label_files
,
perc
=
0.20
):
def
setup_pipeline
(
self
,
data_files
,
label_files
,
perc
=
0.20
):
num_files
=
len
(
data_files
)
num_files
=
len
(
data_files
)
num_test_files
=
int
(
num_files
*
perc
)
num_test_files
=
int
(
num_files
*
perc
)
num_train_files
=
num_files
-
num_test_files
num_train_files
=
num_files
-
num_test_files
...
@@ -859,7 +859,7 @@ class UNET:
...
@@ -859,7 +859,7 @@ class UNET:
def
run
(
self
,
directory
):
def
run
(
self
,
directory
):
data_files
=
glob
.
glob
(
directory
+
'
mod_res*.npy
'
)
data_files
=
glob
.
glob
(
directory
+
'
mod_res*.npy
'
)
label_files
=
[
f
.
replace
(
'
mod
'
,
'
img
'
)
for
f
in
data_files
]
label_files
=
[
f
.
replace
(
'
mod
'
,
'
img
'
)
for
f
in
data_files
]
self
.
setup_pipeline
_files
(
data_files
,
label_files
)
self
.
setup_pipeline
(
data_files
,
label_files
)
self
.
build_model
()
self
.
build_model
()
self
.
build_training
()
self
.
build_training
()
self
.
build_evaluation
()
self
.
build_evaluation
()
...
...
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