提交 e6d7c5e9 编写于 作者: M Megvii Engine Team

docs(mge): fix docstring in loss and dataset

GitOrigin-RevId: 6b566734157eaeaa176f735254ac5e8bba96914f
上级 f91881ff
......@@ -69,20 +69,26 @@ class ImageNet(ImageFolder):
"""
def __init__(self, root: str = None, train: bool = True, **kwargs):
r"""initilization
r"""
initialization:
if ``root`` contains ``self.target_folder`` depent on ``train``:
initialize ImageFolder with target_folder
else:
if all raw files are in ``root``:
parse ``self.target_folder`` from raw files
initialize ImageFolder with ``self.target_folder``
else:
raise error
* if ``root`` contains ``self.target_folder`` depent on ``train``:
* initialize ImageFolder with target_folder
* else:
* if all raw files are in ``root``:
* parse ``self.target_folder`` from raw files
* initialize ImageFolder with ``self.target_folder``
* else:
* raise error
:param root: root directory of imagenet data, if root is ``None``, used default_dataset_root
:param train: if ``True``, load the train split, otherwise load the validation split
:param **kwarg: other keyword arguments for ImageFolder init
"""
# process the root path
......
......@@ -52,27 +52,23 @@ class VisionTransform(Transform):
order is used to specify the order of structures. For example, if your input
is (image, boxes) type, then the order should be ("image", "boxes").
Current available strings & data type are describe below:
"image":
input image, with shape of (H, W, C)
"coords":
coordinates, with shape of (N, 2)
"boxes":
bounding boxes, with shape of (N, 4), "xyxy" format,
* "image": input image, with shape of (H, W, C)
* "coords": coordinates, with shape of (N, 2)
* "boxes": bounding boxes, with shape of (N, 4), "xyxy" format,
the 1st "xy" represents top left point of a box,
the 2nd "xy" represents right bottom point.
"mask":
map used for segmentation, with shape of (H, W, 1)
"keypoints":
keypoints with shape of (N, K, 3), N for number of instances, and K for number of keypoints in one instance. The first two dimensions
* "mask": map used for segmentation, with shape of (H, W, 1)
* "keypoints": keypoints with shape of (N, K, 3), N for number of instances,
and K for number of keypoints in one instance. The first two dimensions
of last axis is coordinate of keypoints and the the 3rd dimension is
the label of keypoints.
"polygons": A sequence contains numpy array, its length is number of instances.
* "polygons": A sequence contains numpy array, its length is number of instances.
Each numpy array represents polygon coordinate of one instance.
"category": categories for some data type. For example, "image_category"
* "category": categories for some data type. For example, "image_category"
means category of the input image and "boxes_category" means categories of
bounding boxes.
"info":
information for images such as image shapes and image path.
* "info": information for images such as image shapes and image path.
You can also customize your data types only if you implement the corresponding
_apply_*() methods, otherwise ``NotImplementedError`` will be raised.
......
......@@ -156,8 +156,10 @@ def cross_entropy_with_softmax(
It has better numerical stability compared with sequential calls to :func:`~.softmax` and :func:`~.cross_entropy`.
When using label smoothing, the label distribution is as follows:
.. math::
y^{LS}_{k}=y_{k}\left(1-\alpha\right)+\alpha/K
where :math:`y^{LS}` and :math:`y` are new label distribution and origin label distribution respectively.
k is the index of label distribution. :math:`\alpha` is label_smooth and :math:`K` is the number of classes.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册