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
27746043
Commit
27746043
authored
Sep 27, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify code & loader
parent
425d3a30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
tensorpack/dataflow/imgaug/crop.py
tensorpack/dataflow/imgaug/crop.py
+2
-8
tensorpack/tfutils/sessinit.py
tensorpack/tfutils/sessinit.py
+9
-1
No files found.
tensorpack/dataflow/imgaug/crop.py
View file @
27746043
...
@@ -25,15 +25,9 @@ class RandomCrop(ImageAugmentor):
...
@@ -25,15 +25,9 @@ class RandomCrop(ImageAugmentor):
assert
orig_shape
[
0
]
>=
self
.
crop_shape
[
0
]
\
assert
orig_shape
[
0
]
>=
self
.
crop_shape
[
0
]
\
and
orig_shape
[
1
]
>=
self
.
crop_shape
[
1
],
orig_shape
and
orig_shape
[
1
]
>=
self
.
crop_shape
[
1
],
orig_shape
diffh
=
orig_shape
[
0
]
-
self
.
crop_shape
[
0
]
diffh
=
orig_shape
[
0
]
-
self
.
crop_shape
[
0
]
if
diffh
==
0
:
h0
=
0
if
diffh
==
0
else
self
.
rng
.
randint
(
diffh
)
h0
=
0
else
:
h0
=
self
.
rng
.
randint
(
diffh
)
diffw
=
orig_shape
[
1
]
-
self
.
crop_shape
[
1
]
diffw
=
orig_shape
[
1
]
-
self
.
crop_shape
[
1
]
if
diffw
==
0
:
w0
=
0
if
diffw
==
0
else
self
.
rng
.
randint
(
diffw
)
w0
=
0
else
:
w0
=
self
.
rng
.
randint
(
diffw
)
return
(
h0
,
w0
)
return
(
h0
,
w0
)
def
_augment
(
self
,
img
,
param
):
def
_augment
(
self
,
img
,
param
):
...
...
tensorpack/tfutils/sessinit.py
View file @
27746043
...
@@ -6,6 +6,7 @@ import os
...
@@ -6,6 +6,7 @@ import os
from
abc
import
abstractmethod
,
ABCMeta
from
abc
import
abstractmethod
,
ABCMeta
from
collections
import
defaultdict
from
collections
import
defaultdict
import
re
import
re
import
numpy
as
np
import
tensorflow
as
tf
import
tensorflow
as
tf
import
six
import
six
...
@@ -15,7 +16,7 @@ from .varmanip import SessionUpdate, get_savename_from_varname
...
@@ -15,7 +16,7 @@ from .varmanip import SessionUpdate, get_savename_from_varname
__all__
=
[
'SessionInit'
,
'NewSession'
,
'SaverRestore'
,
__all__
=
[
'SessionInit'
,
'NewSession'
,
'SaverRestore'
,
'ParamRestore'
,
'ChainInit'
,
'ParamRestore'
,
'ChainInit'
,
'JustCurrentSession'
]
'JustCurrentSession'
,
'get_model_loader'
]
# TODO they initialize_all at the beginning by default.
# TODO they initialize_all at the beginning by default.
...
@@ -179,3 +180,10 @@ class ChainInit(SessionInit):
...
@@ -179,3 +180,10 @@ class ChainInit(SessionInit):
def
_init
(
self
,
sess
):
def
_init
(
self
,
sess
):
for
i
in
self
.
inits
:
for
i
in
self
.
inits
:
i
.
init
(
sess
)
i
.
init
(
sess
)
def
get_model_loader
(
filename
):
if
filename
.
endswith
(
'.npy'
):
return
ParamRestore
(
np
.
load
(
filename
,
encoding
=
'latin1'
)
.
item
())
else
:
return
SaverRestore
(
filename
)
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