Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cloud removal from solar imagery
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
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
PRESAGE
Cloud removal from solar imagery
Commits
5e4f86a9
Unverified
Commit
5e4f86a9
authored
2 years ago
by
Jay Morgan
Browse files
Options
Downloads
Patches
Plain Diff
Update readme to include predictions
parent
dd9b317b
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+8
-0
8 additions, 0 deletions
README.md
src/cloudremoval/model.py
+3
-3
3 additions, 3 deletions
src/cloudremoval/model.py
tests/test_model.py
+10
-0
10 additions, 0 deletions
tests/test_model.py
with
21 additions
and
3 deletions
README.md
+
8
−
0
View file @
5e4f86a9
...
...
@@ -64,4 +64,12 @@ model = CloudRemover(pretrained=True)
# create a model using a different wavelength
model
=
CloudRemover
(
wavelength
=
"
H-alpha
"
,
pretrained
=
True
)
# test making of predictions
dataset
=
SyntheticClouds
(
download
=
True
,
transform
=
CloudsTransform
())
model
=
CloudRemover
(
pretrained
=
True
)
out
=
model
(
dataset
[
0
].
input
[
None
,...])
*
dataset
[
0
].
mask
[
None
,...]
import
matplotlib.pyplot
as
plt
plt
.
imshow
(
out
[
0
,
0
].
detach
().
cpu
().
numpy
(),
cmap
=
"
Greys_r
"
)
```
This diff is collapsed.
Click to expand it.
src/cloudremoval/model.py
+
3
−
3
View file @
5e4f86a9
...
...
@@ -37,7 +37,7 @@ class CloudAddition(CloudIdentity):
def
forward
(
self
,
cloudy_input
,
cloud_pred
):
cloud_pred
=
self
.
activation
(
cloud_pred
)
if
self
.
squash
:
cloud_pred
=
cloud_pred
*
0.5
+
0.5
cloud_pred
=
cloud_pred
*
0.5
-
0.5
return
cloudy_input
-
cloud_pred
...
...
@@ -57,7 +57,7 @@ class UNet(nn.Module):
def
__init__
(
self
,
n_blocks
:
int
=
6
,
cleaner
=
CloudAddition
(
activation
=
dfp
.
identity
,
squash
=
False
),
cleaner
=
CloudAddition
(),
in_channels
=
1
,
out_channels
=
1
,
init_features
=
16
,
...
...
@@ -148,7 +148,7 @@ class UNet(nn.Module):
dec1
=
self
.
upconv1
(
dec2
)
dec1
=
torch
.
cat
((
dec1
,
enc1
),
dim
=
1
)
dec1
=
self
.
decoder1
(
dec1
)
return
self
.
conv
(
dec1
)
return
self
.
cleaner
(
x
,
self
.
conv
(
dec1
)
)
@staticmethod
def
_block
(
in_channels
,
features
,
name
):
...
...
This diff is collapsed.
Click to expand it.
tests/test_model.py
+
10
−
0
View file @
5e4f86a9
import
dfp
from
cloudremoval.model
import
CloudRemover
from
cloudremoval.dataset
import
SyntheticClouds
,
CloudsTransform
# create a model
model
=
CloudRemover
()
...
...
@@ -8,3 +10,11 @@ model = CloudRemover(pretrained=True)
# create a model using a different wavelength
model
=
CloudRemover
(
wavelength
=
"
H-alpha
"
,
pretrained
=
True
)
# test making of predictions
dataset
=
SyntheticClouds
(
download
=
True
,
transform
=
CloudsTransform
())
model
=
CloudRemover
(
pretrained
=
True
)
out
=
model
(
dataset
[
0
].
input
[
None
,...])
*
dataset
[
0
].
mask
[
None
,...]
import
matplotlib.pyplot
as
plt
plt
.
imshow
(
out
[
0
,
0
].
detach
().
cpu
().
numpy
(),
cmap
=
"
Greys_r
"
)
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