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
adca25e2
Commit
adca25e2
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
b79cb57c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/deeplearning/espcn.py
+8
-22
8 additions, 22 deletions
modules/deeplearning/espcn.py
with
8 additions
and
22 deletions
modules/deeplearning/espcn.py
+
8
−
22
View file @
adca25e2
...
...
@@ -210,14 +210,14 @@ class ESPCN:
self
.
n_chans
=
1
#
self.X_img = tf.keras.Input(shape=(None, None, self.n_chans))
self
.
X_img
=
tf
.
keras
.
Input
(
shape
=
(
None
,
None
,
self
.
n_chans
))
# self.X_img = tf.keras.Input(shape=(36, 36, self.n_chans))
self
.
X_img
=
tf
.
keras
.
Input
(
shape
=
(
32
,
32
,
self
.
n_chans
))
#
self.X_img = tf.keras.Input(shape=(32, 32, self.n_chans))
self
.
inputs
.
append
(
self
.
X_img
)
#
self.inputs.append(tf.keras.Input(shape=(None, None, self.n_chans)))
self
.
inputs
.
append
(
tf
.
keras
.
Input
(
shape
=
(
None
,
None
,
self
.
n_chans
)))
# self.inputs.append(tf.keras.Input(shape=(36, 36, self.n_chans)))
self
.
inputs
.
append
(
tf
.
keras
.
Input
(
shape
=
(
32
,
32
,
self
.
n_chans
)))
#
self.inputs.append(tf.keras.Input(shape=(32, 32, self.n_chans)))
self
.
DISK_CACHE
=
False
...
...
@@ -225,24 +225,16 @@ class ESPCN:
def
get_in_mem_data_batch
(
self
,
idxs
,
is_training
):
if
is_training
:
data_files
=
self
.
train_data_files
label_files
=
self
.
train_label_files
label_files
=
self
.
train_data_files
else
:
data_files
=
self
.
test_data_files
label_files
=
self
.
test_label_files
label_files
=
self
.
test_data_files
data_s
=
[]
label_s
=
[]
for
k
in
idxs
:
f
=
data_files
[
k
]
nda
=
np
.
load
(
f
)
data_s
.
append
(
nda
)
f
=
label_files
[
k
]
nda
=
np
.
load
(
f
)
label_s
.
append
(
nda
)
# data = np.concatenate(data_s)
data
=
np
.
concatenate
(
label_s
)
label
=
np
.
concatenate
(
label_s
)
...
...
@@ -350,12 +342,10 @@ class ESPCN:
dataset
=
dataset
.
map
(
self
.
data_function_evaluate
,
num_parallel_calls
=
8
)
self
.
eval_dataset
=
dataset
def
setup_pipeline
(
self
,
train_data_files
,
t
rain_label_files
,
test_data_files
,
test_label
_files
,
num_train_samples
):
def
setup_pipeline
(
self
,
train_data_files
,
t
est_data
_files
,
num_train_samples
):
self
.
train_data_files
=
train_data_files
self
.
train_label_files
=
train_label_files
self
.
test_data_files
=
test_data_files
self
.
test_label_files
=
test_label_files
trn_idxs
=
np
.
arange
(
len
(
train_data_files
))
np
.
random
.
shuffle
(
trn_idxs
)
...
...
@@ -807,15 +797,11 @@ class ESPCN:
def
run
(
self
,
directory
):
train_data_files
=
glob
.
glob
(
directory
+
'
data_train*.npy
'
)
valid_data_files
=
glob
.
glob
(
directory
+
'
data_valid*.npy
'
)
train_label_files
=
glob
.
glob
(
directory
+
'
label_train*.npy
'
)
valid_label_files
=
glob
.
glob
(
directory
+
'
label_valid*.npy
'
)
train_data_files
.
sort
()
valid_data_files
.
sort
()
train_label_files
.
sort
()
valid_label_files
.
sort
()
self
.
setup_pipeline
(
train_data_files
,
train_label_files
,
valid_data_files
,
valid_label
_files
,
200000
)
self
.
setup_pipeline
(
train_data_files
,
valid_data
_files
,
200000
)
self
.
build_model
()
self
.
build_training
()
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