Browse Source

[FIX] delete incorrect substitution

pull/1/head
Gao Enhao 1 year ago
parent
commit
941bcb867d
4 changed files with 8 additions and 8 deletions
  1. +2
    -2
      abl/data/structures/base_data_element.py
  2. +3
    -3
      abl/data/structures/list_data.py
  3. +1
    -1
      examples/hwf/hwf.ipynb
  4. +2
    -2
      examples/zoo/zoo.ipynb

+ 2
- 2
abl/data/structures/base_data_element.py View File

@@ -7,7 +7,7 @@ import torch


# Modified from
# https://github.com/open-mmlab/mmengine/blob/main/mmengine/data.structures/base_data_element.py
# https://github.com/open-mmlab/mmengine/blob/main/mmengine/structures/base_data_element.py
class BaseDataElement:
"""A base data interface that supports Tensor-like and dict-like
operations.
@@ -74,7 +74,7 @@ class BaseDataElement:

Examples:
>>> import torch
>>> from mmengine.data.structures import BaseDataElement
>>> from mmengine.structures import BaseDataElement
>>> gt_instances = BaseDataElement()
>>> bboxes = torch.rand((5, 4))
>>> scores = torch.rand((5,))


+ 3
- 3
abl/data/structures/list_data.py View File

@@ -15,16 +15,16 @@ IndexType = Union[str, slice, int, list, LongTypeTensor, BoolTypeTensor, np.ndar


# Modified from
# https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/data_data.structures/instance_data.py # noqa
# https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/data_structures/instance_data.py # noqa
class ListData(BaseDataElement):
"""
Data structure for example-level data.

Subclass of :class:`BaseDataElement`. All value in `data_fields`
should have the same length. This design refer to
https://github.com/facebookresearch/detectron2/blob/master/detectron2/data.structures/instances.py
https://github.com/facebookresearch/detectron2/blob/master/detectron2/structures/instances.py

ListData supports `index` and `slice` for data field. The type of value in data field can be either `None` or `list` of base data data.structures such as `torch.Tensor`, `numpy.ndarray`, `list`, `str` and `tuple`.
ListData supports `index` and `slice` for data field. The type of value in data field can be either `None` or `list` of base data structures such as `torch.Tensor`, `numpy.ndarray`, `list`, `str` and `tuple`.

Examples:
>>> from abl.data.structures import ListData


+ 1
- 1
examples/hwf/hwf.ipynb View File

@@ -55,7 +55,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Both `train_data` and `test_data` have the same data.structures: tuples with three components: X (list where each element is a list of images), gt_pseudo_label (list where each element is a list of symbols, i.e., pseudo-labels) and Y (list where each element is the computed result). The length and data.structures of datasets are illustrated as follows.\n",
"Both `train_data` and `test_data` have the same structures: tuples with three components: X (list where each element is a list of images), gt_pseudo_label (list where each element is a list of symbols, i.e., pseudo-labels) and Y (list where each element is the computed result). The length and structures of datasets are illustrated as follows.\n",
"\n",
"Note: ``gt_pseudo_label`` is only used to evaluate the performance of the learning part but not to train the model."
]


+ 2
- 2
examples/zoo/zoo.ipynb View File

@@ -56,7 +56,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"`train_data` and `test_data` share identical data.structures: tuples with three components: X (list where each element is a list of two images), gt_pseudo_label (list where each element is a list of two digits, i.e., pseudo-labels) and Y (list where each element is the sum of the two digits). The length and data.structures of datasets are illustrated as follows.\n",
"`train_data` and `test_data` share identical structures: tuples with three components: X (list where each element is a list of two images), gt_pseudo_label (list where each element is a list of two digits, i.e., pseudo-labels) and Y (list where each element is the sum of the two digits). The length and structures of datasets are illustrated as follows.\n",
"\n",
"Note: ``gt_pseudo_label`` is only used to evaluate the performance of the learning part but not to train the model."
]
@@ -356,7 +356,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.8.18"
},
"orig_nbformat": 4,
"vscode": {


Loading…
Cancel
Save