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
8e5a46a4
Commit
8e5a46a4
authored
Feb 28, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't throw when repr(imgaug) fails
parent
26d792d4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
17 deletions
+24
-17
tensorpack/dataflow/imgaug/base.py
tensorpack/dataflow/imgaug/base.py
+22
-17
tensorpack/dataflow/parallel_map.py
tensorpack/dataflow/parallel_map.py
+2
-0
No files found.
tensorpack/dataflow/imgaug/base.py
View file @
8e5a46a4
...
...
@@ -9,6 +9,7 @@ import six
from
six.moves
import
zip
from
...utils.utils
import
get_rng
from
...utils.argtools
import
log_once
from
..image
import
check_dtype
__all__
=
[
'Augmentor'
,
'ImageAugmentor'
,
'AugmentorList'
]
...
...
@@ -81,6 +82,7 @@ class Augmentor(object):
Produce something like:
"imgaug.MyAugmentor(field1={self.field1}, field2={self.field2})"
"""
try
:
argspec
=
inspect
.
getargspec
(
self
.
__init__
)
assert
argspec
.
varargs
is
None
,
"The default __repr__ doesn't work for vaargs!"
assert
argspec
.
keywords
is
None
,
"The default __repr__ doesn't work for kwargs!"
...
...
@@ -91,13 +93,16 @@ class Augmentor(object):
argstr
=
[]
for
idx
,
f
in
enumerate
(
fields
):
assert
hasattr
(
self
,
f
),
\
"Attribute {} not found! The d
efault __repr__ only works if attributes match the constructor."
.
format
(
f
)
"Attribute {} not found! D
efault __repr__ only works if attributes match the constructor."
.
format
(
f
)
attr
=
getattr
(
self
,
f
)
if
idx
>=
index_field_has_default
:
if
attr
is
argspec
.
defaults
[
idx
-
index_field_has_default
]:
continue
argstr
.
append
(
"{}={}"
.
format
(
f
,
pprint
.
pformat
(
attr
)))
return
"imgaug.{}({})"
.
format
(
classname
,
', '
.
join
(
argstr
))
except
AssertionError
as
e
:
log_once
(
e
.
args
[
0
],
'warn'
)
return
super
(
Augmentor
,
self
)
.
__repr__
()
__str__
=
__repr__
...
...
tensorpack/dataflow/parallel_map.py
View file @
8e5a46a4
...
...
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
# File: parallel_map.py
import
numpy
as
np
import
time
import
ctypes
import
copy
import
threading
...
...
@@ -271,6 +272,7 @@ class MultiProcessMapDataZMQ(_ParallelMapData, _MultiProcessZMQDataFlow):
self
.
_iter_worker
=
_repeat_iter
(
lambda
:
iter
(
self
.
_proc_ids
))
self
.
_start_processes
()
time
.
sleep
(
5
)
# TODO temporarily work around #673
self
.
_fill_buffer
()
# pre-fill the bufer
def
reset_state
(
self
):
...
...
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