Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
f1a8acf4
Commit
f1a8acf4
authored
Mar 26, 2020
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make Image2Image support windows (fix #1412)
parent
e50423db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
examples/GAN/Image2Image.py
examples/GAN/Image2Image.py
+5
-4
tensorpack/models/batch_norm.py
tensorpack/models/batch_norm.py
+1
-0
tensorpack/tfutils/common.py
tensorpack/tfutils/common.py
+1
-1
No files found.
examples/GAN/Image2Image.py
View file @
f1a8acf4
...
@@ -146,11 +146,12 @@ class Model(GANModelDesc):
...
@@ -146,11 +146,12 @@ class Model(GANModelDesc):
return
tf
.
train
.
AdamOptimizer
(
lr
,
beta1
=
0.5
,
epsilon
=
1e-3
)
return
tf
.
train
.
AdamOptimizer
(
lr
,
beta1
=
0.5
,
epsilon
=
1e-3
)
def
split_input
(
img
):
def
split_input
(
dp
):
"""
"""
img:
an RGB image of shape (s, 2s, 3).
dp: the datapoint. first component is
an RGB image of shape (s, 2s, 3).
:return: [input, output]
:return: [input, output]
"""
"""
img
=
dp
[
0
]
# split the image into left + right pairs
# split the image into left + right pairs
s
=
img
.
shape
[
0
]
s
=
img
.
shape
[
0
]
assert
img
.
shape
[
1
]
==
2
*
s
assert
img
.
shape
[
1
]
==
2
*
s
...
@@ -169,7 +170,7 @@ def get_data():
...
@@ -169,7 +170,7 @@ def get_data():
imgs
=
glob
.
glob
(
os
.
path
.
join
(
datadir
,
'*.jpg'
))
imgs
=
glob
.
glob
(
os
.
path
.
join
(
datadir
,
'*.jpg'
))
ds
=
ImageFromFile
(
imgs
,
channel
=
3
,
shuffle
=
True
)
ds
=
ImageFromFile
(
imgs
,
channel
=
3
,
shuffle
=
True
)
ds
=
MapData
(
ds
,
lambda
dp
:
split_input
(
dp
[
0
])
)
ds
=
MapData
(
ds
,
split_input
)
augs
=
[
imgaug
.
Resize
(
286
),
imgaug
.
RandomCrop
(
256
)]
augs
=
[
imgaug
.
Resize
(
286
),
imgaug
.
RandomCrop
(
256
)]
ds
=
AugmentImageComponents
(
ds
,
augs
,
(
0
,
1
))
ds
=
AugmentImageComponents
(
ds
,
augs
,
(
0
,
1
))
ds
=
BatchData
(
ds
,
BATCH
)
ds
=
BatchData
(
ds
,
BATCH
)
...
@@ -186,7 +187,7 @@ def sample(datadir, model_path):
...
@@ -186,7 +187,7 @@ def sample(datadir, model_path):
imgs
=
glob
.
glob
(
os
.
path
.
join
(
datadir
,
'*.jpg'
))
imgs
=
glob
.
glob
(
os
.
path
.
join
(
datadir
,
'*.jpg'
))
ds
=
ImageFromFile
(
imgs
,
channel
=
3
,
shuffle
=
True
)
ds
=
ImageFromFile
(
imgs
,
channel
=
3
,
shuffle
=
True
)
ds
=
MapData
(
ds
,
lambda
dp
:
split_input
(
dp
[
0
])
)
ds
=
MapData
(
ds
,
split_input
)
ds
=
AugmentImageComponents
(
ds
,
[
imgaug
.
Resize
(
256
)],
(
0
,
1
))
ds
=
AugmentImageComponents
(
ds
,
[
imgaug
.
Resize
(
256
)],
(
0
,
1
))
ds
=
BatchData
(
ds
,
6
)
ds
=
BatchData
(
ds
,
6
)
...
...
tensorpack/models/batch_norm.py
View file @
f1a8acf4
# Copyright (c) Tensorpack Contributors. All Rights Reserved
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# File: batch_norm.py
# File: batch_norm.py
...
...
tensorpack/tfutils/common.py
View file @
f1a8acf4
...
@@ -201,7 +201,7 @@ def collect_env_info():
...
@@ -201,7 +201,7 @@ def collect_env_info():
# List devices with NVML
# List devices with NVML
data
.
append
(
data
.
append
(
(
"CUDA_VISIBLE_DEVICES"
,
(
"CUDA_VISIBLE_DEVICES"
,
os
.
environ
.
get
(
"CUDA_VISIBLE_DEVICES"
,
str
(
None
)
)))
os
.
environ
.
get
(
"CUDA_VISIBLE_DEVICES"
,
"Unspecified"
)))
try
:
try
:
devs
=
defaultdict
(
list
)
devs
=
defaultdict
(
list
)
with
NVMLContext
()
as
ctx
:
with
NVMLContext
()
as
ctx
:
...
...
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