Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Unconditional Diffusion
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Diffusion Project
Unconditional Diffusion
Commits
7e935796
Commit
7e935796
authored
1 year ago
by
Gonzalo Martin Garcia
Browse files
Options
Downloads
Patches
Plain Diff
forgot to update no transform for the celebAHQ dataloader
parent
25d26f13
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dataloader/load.py
+8
-12
8 additions, 12 deletions
dataloader/load.py
with
8 additions
and
12 deletions
dataloader/load.py
+
8
−
12
View file @
7e935796
...
...
@@ -75,12 +75,12 @@ class UnconditionalDataset_CelebAHQ(Dataset):
"""
Args:
fpath (string): Path to the folder where images are stored
img_size (int):
s
ize of output image img_size=height=width
ext (string):
t
ype of images used(eg .png)
img_size (int):
S
ize of output image img_size=height=width
ext (string):
T
ype of images used(eg .png)
transform (Bool): Image augmentation for diffusion model
skip_first_n:
s
kips the first n values. Usefull for datasets that are sorted by increasing Likeliehood
skip_first_n:
S
kips the first n values. Usefull for datasets that are sorted by increasing Likeliehood
train (Bool): Choose dataset to be either train set or test set. frac(float) required
frac (float):
v
alue within (0,1] (seeded)random shuffles dataset, then divides into train and test set.
frac (float):
V
alue within (0,1] (seeded)random shuffles dataset, then divides into train and test set.
"""
# they provide a fixed train and validation split
if
train
:
...
...
@@ -96,7 +96,6 @@ class UnconditionalDataset_CelebAHQ(Dataset):
self
.
df
=
df
[
df
[
"
Filepath
"
].
str
.
endswith
(
ext
)]
if
transform
:
# for training
intermediate_size
=
137
theta
=
np
.
pi
/
4
-
np
.
arccos
(
intermediate_size
/
(
np
.
sqrt
(
2
)
*
img_size
))
#Check dataloading.ipynb in analysis-depot for more details
...
...
@@ -107,7 +106,6 @@ class UnconditionalDataset_CelebAHQ(Dataset):
transforms
.
RandomHorizontalFlip
(
p
=
0.5
),
transforms
.
Normalize
(
mean
=
(
0.5
,
0.5
,
0.5
),
std
=
(
0.5
,
0.5
,
0.5
))])
transform_flip
=
transforms
.
Compose
([
transforms
.
ToTensor
(),
transforms
.
Resize
(
img_size
,
antialias
=
True
),
transforms
.
RandomHorizontalFlip
(
p
=
0.5
),
...
...
@@ -115,9 +113,7 @@ class UnconditionalDataset_CelebAHQ(Dataset):
self
.
transform
=
transforms
.
RandomChoice
([
transform_rotate_flip
,
transform_flip
])
else
:
# for evaluation
self
.
transform
=
transforms
.
Compose
([
transforms
.
ToTensor
(),
transforms
.
Lambda
(
lambda
x
:
(
x
*
255
).
type
(
torch
.
uint8
)),
transforms
.
Resize
(
img_size
)])
def
__len__
(
self
):
...
...
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