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
1ea45d73
"src/components/Dashboard/Dashboard.tsx" did not exist on "b331727c43ce5f0bbf9b2d66091807298db74584"
Commit
1ea45d73
authored
4 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Added date to each scene of the Cloud95 dataset
parent
8be76bef
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
pytorch/dataset.py
+22
-10
22 additions, 10 deletions
pytorch/dataset.py
with
22 additions
and
10 deletions
pytorch/dataset.py
+
22
−
10
View file @
1ea45d73
...
...
@@ -12,22 +12,20 @@ your custom dataset.
# -*- coding: utf-8 -*-
# builtins
from
__future__
import
absolute_import
import
os
import
re
import
sys
import
csv
import
glob
import
itertools
# externals
import
gdal
import
numpy
as
np
import
torch
from
torch.utils.data
import
Dataset
# append path to local files to the python search path
sys
.
path
.
append
(
'
..
'
)
# locals
from
pytorch.constants
import
(
Landsat8
,
Sentinel2
,
SparcsLabels
,
Cloud95Labels
,
ProSnowLabels
)
...
...
@@ -404,6 +402,7 @@ class StandardEoDataset(ImageDataset):
return
scenes
# SparcsDataset class: inherits from the generic ImageDataset class
class
SparcsDataset
(
StandardEoDataset
):
...
...
@@ -504,6 +503,9 @@ class Cloud95Dataset(ImageDataset):
# patches resulting from the black margins around a Landsat 8 scene
self
.
exclude
=
exclude
# function that parses the date from a Landsat 8 scene id
self
.
date_parser
=
parse_landsat8_date
# list of all scenes in the root directory
# each scene is divided into tiles blocks
self
.
scenes
=
self
.
compose_scenes
()
...
...
@@ -565,6 +567,9 @@ class Cloud95Dataset(ImageDataset):
# get name of the current patch
patchname
=
file
.
split
(
'
.
'
)[
0
].
replace
(
biter
+
'
_
'
,
''
)
# get the date of the current scene
date
=
self
.
date_parser
(
patchname
)
# check whether the current file is an informative patch
if
ipatches
and
patchname
not
in
ipatches
:
continue
...
...
@@ -584,9 +589,16 @@ class Cloud95Dataset(ImageDataset):
# store tile number
scene
[
'
tile
'
]
=
tile
# store date
scene
[
'
date
'
]
=
date
# append patch to list of all patches
scenes
.
append
(
scene
)
# sort list of scenes in chronological order
if
self
.
sort
:
scenes
.
sort
(
key
=
lambda
k
:
k
[
'
date
'
])
return
scenes
...
...
@@ -594,8 +606,8 @@ if __name__ == '__main__':
# define path to working directory
# wd = '//projectdata.eurac.edu/projects/cci_snow/dfrisinghelli/'
wd
=
'
/mnt/CEPH_PROJECTS/cci_snow/dfrisinghelli
'
#
wd = 'C:/Eurac/2020/'
#
wd = '/mnt/CEPH_PROJECTS/cci_snow/dfrisinghelli'
wd
=
'
C:/Eurac/2020/
'
# path to the preprocessed sparcs dataset
sparcs_path
=
os
.
path
.
join
(
wd
,
'
_Datasets/Sparcs
'
)
...
...
@@ -625,7 +637,7 @@ if __name__ == '__main__':
tile_size
=
None
,
use_bands
=
[
'
nir
'
,
'
red
'
,
'
green
'
],
sort
=
True
)
obergurgl
=
ProSnowObergurgl
(
os
.
path
.
join
(
prosnow_path
,
'
Obergurgl
'
),
tile_size
=
None
,
use_bands
=
[
'
nir
'
,
'
red
'
,
'
green
'
],
sort
=
True
)
#
obergurgl = ProSnowObergurgl(os.path.join(prosnow_path, 'Obergurgl'),
#
tile_size=None,
#
use_bands=['nir', 'red', 'green'],
#
sort=True)
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