Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
FML Project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Meet Narendra
FML Project
Commits
c4288d29
Commit
c4288d29
authored
Nov 23, 2022
by
Meet Narendra
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speeding up training
parent
f462bad0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
1703.10593/preprocess.py
1703.10593/preprocess.py
+2
-2
1703.10593/train.py
1703.10593/train.py
+5
-2
No files found.
1703.10593/preprocess.py
View file @
c4288d29
...
...
@@ -17,8 +17,8 @@ class LoadData(Dataset):
self
.
pair
=
pair
self
.
type
=
type_data
self
.
transform
=
transforms
.
Compose
([
transforms
.
Resize
(
int
(
256
*
1.12
),
Image
.
BICUBIC
),
transforms
.
RandomCrop
(
256
),
transforms
.
Resize
(
int
(
64
*
1.12
),
Image
.
BICUBIC
),
transforms
.
RandomCrop
(
64
),
transforms
.
RandomHorizontalFlip
(),
transforms
.
ToTensor
(),
transforms
.
Normalize
((
0.5
,
0.5
,
0.5
),
(
0.5
,
0.5
,
0.5
)),
...
...
1703.10593/train.py
View file @
c4288d29
import
numpy
as
np
import
itertools
import
torch
from
torch.utils.data
import
Dataset
,
DataLoader
from
torchvision.utils
import
save_image
...
...
@@ -15,13 +16,15 @@ LOGGER.info("Cuda status: "+str(device))
torch
.
cuda
.
empty_cache
()
import
os
class
Train
():
def
__init__
(
self
,
data
=
"dataset/
vangogh2photo
"
,
pair
=
False
,
epochs
=
200
,
batch_size
=
1
):
def
__init__
(
self
,
data
=
"dataset/
summer2winter_yosemite
"
,
pair
=
False
,
epochs
=
200
,
batch_size
=
1
):
'''
@params
@return
'''
if
not
os
.
path
.
exists
(
"images"
):
os
.
mkdir
(
"images"
)
if
not
os
.
path
.
exists
(
"weights"
):
os
.
mkdir
(
"weights"
)
self
.
epochs
=
epochs
self
.
batch_size
=
batch_size
...
...
@@ -34,7 +37,7 @@ class Train():
self
.
dis_X
.
apply
(
initialize_weights
)
self
.
dis_Y
.
apply
(
initialize_weights
)
self
.
gen_XY_optim
=
torch
.
optim
.
Adam
(
self
.
gen_XY
.
parameters
(
),
lr
=
0.0002
,
betas
=
(
0.5
,
0.999
))
self
.
gen_XY_optim
=
torch
.
optim
.
Adam
(
itertools
.
chain
(
self
.
gen_XY
.
parameters
(),
self
.
gen_YX
.
parameters
()
),
lr
=
0.0002
,
betas
=
(
0.5
,
0.999
))
self
.
dis_X_optim
=
torch
.
optim
.
Adam
(
self
.
dis_X
.
parameters
(),
lr
=
0.0002
,
betas
=
(
0.5
,
0.999
))
self
.
dis_Y_optim
=
torch
.
optim
.
Adam
(
self
.
dis_Y
.
parameters
(),
lr
=
0.0002
,
betas
=
(
0.5
,
0.999
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment