Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
models
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
models
Commits
cf085f79
Commit
cf085f79
authored
Apr 06, 2017
by
Lukasz Kaiser
Committed by
GitHub
Apr 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1309 from bousmalis/master
More DSN updates
parents
d6bee2c7
09bc6113
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
52 deletions
+12
-52
README.md
domain_adaptation/README.md
+4
-4
dsn_eval.py
domain_adaptation/domain_separation/dsn_eval.py
+2
-17
dsn_train.py
domain_adaptation/domain_separation/dsn_train.py
+2
-25
losses.py
domain_adaptation/domain_separation/losses.py
+4
-6
No files found.
domain_adaptation/README.md
View file @
cf085f79
...
...
@@ -30,16 +30,16 @@ MNIST and MNIST-M:
$ export DSN_DATA_DIR=/your/dir
```
Then you need to build the binaries with Bazel
:
Add models and models/slim to your
`$PYTHONPATH`
:
```
$
bazel build -c opt domain_adaptation/domain_separation/...
$
export PYTHONPATH=$PYTHONPATH:$PWD:$PWD/slim
```
Add models and models/slim to your
`$PYTHONPATH`
:
Then you need to build the binaries with Bazel
:
```
$
export PYTHONPATH=$PYTHONPATH:$PWD:$PWD/slim
$
bazel build -c opt domain_adaptation/domain_separation/...
```
You can then train with the following command:
...
...
domain_adaptation/domain_separation/dsn_eval.py
View file @
cf085f79
...
...
@@ -14,22 +14,7 @@
# ==============================================================================
# pylint: disable=line-too-long
r"""Evaluation for Domain Separation Networks (DSNs).
To build locally for CPU:
blaze build -c opt --copt=-mavx
\
third_party/tensorflow_models/domain_adaptation/domain_separation:dsn_eval
To build locally for GPU:
blaze build -c opt --copt=-mavx --config=cuda_clang
\
third_party/tensorflow_models/domain_adaptation/domain_separation:dsn_eval
To run locally:
$
./blaze-bin/third_party/tensorflow_models/domain_adaptation/domain_separation/dsn_eval
\
--alsologtostderr
"""
"""Evaluation for Domain Separation Networks (DSNs)."""
# pylint: enable=line-too-long
import
math
...
...
@@ -57,7 +42,7 @@ tf.app.flags.DEFINE_string(
'eval_dir'
,
'/tmp/da/'
,
'Directory where we should write the tf summaries to.'
)
tf
.
app
.
flags
.
DEFINE_string
(
'dataset_dir'
,
'/cns/ok-d/home/konstantinos/cad_learning/'
,
tf
.
app
.
flags
.
DEFINE_string
(
'dataset_dir'
,
None
,
'The directory where the dataset files are stored.'
)
tf
.
app
.
flags
.
DEFINE_string
(
'dataset'
,
'mnist_m'
,
...
...
domain_adaptation/domain_separation/dsn_train.py
View file @
cf085f79
...
...
@@ -13,30 +13,7 @@
# limitations under the License.
# ==============================================================================
# pylint: disable=line-too-long
r"""Training for Domain Separation Networks (DSNs).
-- Compile:
$ blaze build -c opt --copt=-mavx --config=cuda
\
third_party/tensorflow_models/domain_adaptation/domain_separation:dsn_train
-- Run:
$
./blaze-bin/third_party/tensorflow_models/domain_adaptation/domain_separation/dsn_train
\
--similarity_loss=dann
\
--basic_tower=dsn_cropped_linemod
\
--source_dataset=pose_synthetic
\
--target_dataset=pose_real
\
--learning_rate=0.012
\
--alpha_weight=0.26
\
--gamma_weight=0.0115
\
--weight_decay=4e-5
\
--layers_to_regularize=fc3
\
--use_separation
\
--alsologtostderr
"""
# pylint: enable=line-too-long
"""Training for Domain Separation Networks (DSNs)."""
from
__future__
import
division
import
tensorflow
as
tf
...
...
@@ -59,7 +36,7 @@ tf.app.flags.DEFINE_string('target_dataset', 'pose_real',
tf
.
app
.
flags
.
DEFINE_string
(
'target_labeled_dataset'
,
'none'
,
'Target dataset to train on.'
)
tf
.
app
.
flags
.
DEFINE_string
(
'dataset_dir'
,
'/cns/ok-d/home/konstantinos/cad_learning/'
,
tf
.
app
.
flags
.
DEFINE_string
(
'dataset_dir'
,
None
,
'The directory where the dataset files are stored.'
)
tf
.
app
.
flags
.
DEFINE_string
(
'master'
,
''
,
...
...
domain_adaptation/domain_separation/losses.py
View file @
cf085f79
...
...
@@ -178,16 +178,14 @@ def dann_loss(source_samples, target_samples, weight, scope=None):
assert_op
=
tf
.
Assert
(
tf
.
is_finite
(
domain_loss
),
[
domain_loss
])
with
tf
.
control_dependencies
([
assert_op
]):
tag_loss
=
'losses/
Domain L
oss'
tag_accuracy
=
'losses/
Domain A
ccuracy'
tag_loss
=
'losses/
domain_l
oss'
tag_accuracy
=
'losses/
domain_a
ccuracy'
if
scope
:
tag_loss
=
scope
+
tag_loss
tag_accuracy
=
scope
+
tag_accuracy
tf
.
summary
.
scalar
(
tag_loss
,
domain_loss
,
name
=
'domain_loss_summary'
)
tf
.
summary
.
scalar
(
tag_accuracy
,
domain_accuracy
,
name
=
'domain_accuracy_summary'
)
tf
.
summary
.
scalar
(
tag_loss
,
domain_loss
)
tf
.
summary
.
scalar
(
tag_accuracy
,
domain_accuracy
)
return
domain_loss
...
...
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