Commit 27957082 authored by Yuxin Wu's avatar Yuxin Wu

docs update

parent c94585b4
......@@ -363,6 +363,7 @@ def autodoc_skip_member(app, what, name, obj, skip, options):
'predictor_factory',
'get_predictors',
'vs_name_for_predictor',
'RandomCropAroundBox',
'dump_chkpt_vars',
'VisualQA',
'ParamRestore']:
......
......@@ -32,19 +32,20 @@ the argument `inputs` is the list of input tensors matching `_get_inputs`.
You can use any symbolic functions in `_build_graph`, including TensorFlow core library
functions and other symbolic libraries.
### How is it Used:
### How it is Used:
Most tensorpack trainers expect a `ModelDesc`, and use it as a __description
of the TF graph__ (except for the input pipeline).
of the TF graph to be built__.
These trainers will use `_get_inputs` to connect the given `InputSource` to the graph.
They'll then use `_build_graph` to create the backbone model, and then `_get_optimizer` to create the minimization op, and run it.
Note that data-parallel multi-GPU trainers will call `_build_graph` __multiple times__ on each GPU.
A trainer may also make __extra calls__ to `_build_graph` for inference, if used by some callbacks.
`_build_graph` will always be called under some `TowerContext` which contains these information
`_build_graph` will always be called under some `TowerContext` which contains these context information
(e.g. training or inference, reuse or not, scope name) for your access.
Also, to respect variable reuse among multiple calls, use `tf.get_variable()` instead of `tf.Variable`.
Also, to respect variable reuse among multiple calls, use `tf.get_variable()` instead of `tf.Variable` in `_build_graph`,
if you need to create and variables.
### Build It Manually
......
......@@ -9,8 +9,7 @@ from ...utils.argtools import shape2d
from six.moves import range
import numpy as np
__all__ = ['RandomCrop', 'CenterCrop',
'perturb_BB', 'RandomCropAroundBox', 'RandomCropRandomShape']
__all__ = ['RandomCrop', 'CenterCrop', 'RandomCropAroundBox', 'RandomCropRandomShape']
class RandomCrop(ImageAugmentor):
......@@ -111,9 +110,10 @@ def perturb_BB(image_shape, bb, max_perturb_pixel,
return bb
# TODO shouldn't include strange augmentors like this.
class RandomCropAroundBox(ImageAugmentor):
"""
Crop a box around a bounding box by some random perturbation
Crop a box around a bounding box by some random perturbation.
"""
def __init__(self, perturb_ratio, max_aspect_ratio_diff=0.3):
......
......@@ -150,7 +150,7 @@ class PrefetchDataZMQ(ProxyDataFlow):
nr_proc (int): number of processes to use.
hwm (int): the zmq "high-water mark" for both sender and receiver.
"""
assert os.name != 'nt', "PrefetchDataZMQ doesn't support windows! Consider PrefetchData instead."
assert os.name != 'nt', "PrefetchDataZMQ doesn't support windows! PrefetchData might work sometimes."
super(PrefetchDataZMQ, self).__init__(ds)
try:
self._size = ds.size()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment