Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.pytorch
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
bob
bob.learn.pytorch
Commits
5e4e50df
Commit
5e4e50df
authored
7 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
[dataset] added a transform to resize images
parent
45119335
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/learn/pytorch/datasets/__init__.py
+1
-0
1 addition, 0 deletions
bob/learn/pytorch/datasets/__init__.py
bob/learn/pytorch/datasets/utils.py
+14
-0
14 additions, 0 deletions
bob/learn/pytorch/datasets/utils.py
with
15 additions
and
0 deletions
bob/learn/pytorch/datasets/__init__.py
+
1
−
0
View file @
5e4e50df
...
@@ -6,6 +6,7 @@ from .utils import FaceCropper
...
@@ -6,6 +6,7 @@ from .utils import FaceCropper
from
.utils
import
RollChannels
from
.utils
import
RollChannels
from
.utils
import
ToTensor
from
.utils
import
ToTensor
from
.utils
import
Normalize
from
.utils
import
Normalize
from
.utils
import
Resize
from
.utils
import
map_labels
from
.utils
import
map_labels
from
.utils
import
ConcatDataset
from
.utils
import
ConcatDataset
...
...
This diff is collapsed.
Click to expand it.
bob/learn/pytorch/datasets/utils.py
+
14
−
0
View file @
5e4e50df
...
@@ -54,6 +54,20 @@ class Normalize(object):
...
@@ -54,6 +54,20 @@ class Normalize(object):
sample
[
'
image
'
]
=
self
.
op
(
sample
[
'
image
'
])
sample
[
'
image
'
]
=
self
.
op
(
sample
[
'
image
'
])
return
sample
return
sample
class
Resize
(
object
):
def
__init__
(
self
,
size
):
self
.
op
=
transforms
.
Resize
(
size
)
def
__call__
(
self
,
sample
):
# convert to PIL image
from
PIL.Image
import
fromarray
img
=
fromarray
(
sample
[
'
image
'
].
squeeze
())
img
=
self
.
op
(
img
)
sample
[
'
image
'
]
=
numpy
.
array
(
img
)
sample
[
'
image
'
]
=
sample
[
'
image
'
][...,
numpy
.
newaxis
]
return
sample
def
map_labels
(
raw_labels
,
start_index
=
0
):
def
map_labels
(
raw_labels
,
start_index
=
0
):
"""
"""
Map the ID label to [0 - # of IDs]
Map the ID label to [0 - # of IDs]
...
...
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