Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
deepdraw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
medai
software
deepdraw
Commits
6b1409f9
Commit
6b1409f9
authored
4 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[data.utils] Fix SSLDataset and test it (limited)
parent
aac49966
No related branches found
No related tags found
1 merge request
!12
Streamlining
Pipeline
#38965
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/ip/binseg/data/utils.py
+1
-1
1 addition, 1 deletion
bob/ip/binseg/data/utils.py
bob/ip/binseg/test/test_config.py
+28
-0
28 additions, 0 deletions
bob/ip/binseg/test/test_config.py
with
29 additions
and
1 deletion
bob/ip/binseg/data/utils.py
+
1
−
1
View file @
6b1409f9
...
...
@@ -228,6 +228,6 @@ class SSLDataset(torch.utils.data.Dataset):
retval
=
self
.
labelled
[
index
]
# gets one an unlabelled sample randomly to follow the labelled sample
unlab
=
self
.
unlabelled
[
torch
.
randint
(
len
(
self
.
unlabelled
))]
unlab
=
self
.
unlabelled
[
torch
.
randint
(
len
(
self
.
unlabelled
)
,
()
)]
# only interested in key and data
return
retval
+
unlab
[:
2
]
This diff is collapsed.
Click to expand it.
bob/ip/binseg/test/test_config.py
+
28
−
0
View file @
6b1409f9
...
...
@@ -329,6 +329,34 @@ def test_covd_drive():
nose
.
tools
.
eq_
(
sample
[
3
].
dtype
,
torch
.
float32
)
@rc_variable_set
(
"
bob.ip.binseg.drive.datadir
"
)
@rc_variable_set
(
"
bob.ip.binseg.stare.datadir
"
)
@rc_variable_set
(
"
bob.ip.binseg.chasedb1.datadir
"
)
@rc_variable_set
(
"
bob.ip.binseg.hrf.datadir
"
)
@rc_variable_set
(
"
bob.ip.binseg.iostar.datadir
"
)
def
test_covd_drive_ssl
():
from
..configs.datasets.covd_drive_ssl
import
dataset
nose
.
tools
.
eq_
(
len
(
dataset
),
53
)
for
sample
in
dataset
:
assert
5
<=
len
(
sample
)
<=
6
assert
isinstance
(
sample
[
0
],
str
)
nose
.
tools
.
eq_
(
sample
[
1
].
shape
,
(
3
,
544
,
544
))
#planes, height, width
nose
.
tools
.
eq_
(
sample
[
1
].
dtype
,
torch
.
float32
)
nose
.
tools
.
eq_
(
sample
[
2
].
shape
,
(
1
,
544
,
544
))
#planes, height, width
nose
.
tools
.
eq_
(
sample
[
2
].
dtype
,
torch
.
float32
)
if
len
(
sample
)
==
6
:
nose
.
tools
.
eq_
(
sample
[
3
].
shape
,
(
1
,
544
,
544
))
#planes, height, width
nose
.
tools
.
eq_
(
sample
[
3
].
dtype
,
torch
.
float32
)
assert
isinstance
(
sample
[
4
],
str
)
nose
.
tools
.
eq_
(
sample
[
5
].
shape
,
(
3
,
544
,
544
))
#planes, height, width
nose
.
tools
.
eq_
(
sample
[
5
].
dtype
,
torch
.
float32
)
else
:
assert
isinstance
(
sample
[
3
],
str
)
nose
.
tools
.
eq_
(
sample
[
4
].
shape
,
(
3
,
544
,
544
))
#planes, height, width
nose
.
tools
.
eq_
(
sample
[
4
].
dtype
,
torch
.
float32
)
@rc_variable_set
(
"
bob.ip.binseg.drive.datadir
"
)
@rc_variable_set
(
"
bob.ip.binseg.chasedb1.datadir
"
)
@rc_variable_set
(
"
bob.ip.binseg.hrf.datadir
"
)
...
...
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