You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -447,7 +448,7 @@ an attribute, you'll get the following error:
447
448
.. code-block:: shell
448
449
449
450
$ python export_attr.py
450
-
RuntimeError: Cannot serialize custom bound C++ class __torch__.torch.classes.MyStackClass. Please define serialization methods via def_pickle for this class. (pushIValueImpl at ../torch/csrc/jit/pickler.cpp:128)
451
+
RuntimeError: Cannot serialize custom bound C++ class __torch__.torch.classes.my_classes.MyStackClass. Please define serialization methods via def_pickle for this class. (pushIValueImpl at ../torch/csrc/jit/pickler.cpp:128)
451
452
452
453
This is because TorchScript cannot automatically figure out what information
453
454
save from your C++ class. You must specify that manually. The way to do that
@@ -466,7 +467,7 @@ Here is an example of how we can update the registration code for our
Copy file name to clipboardExpand all lines: intermediate_source/torchvision_tutorial.rst
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ should return:
32
32
- ``boxes (FloatTensor[N, 4])``: the coordinates of the ``N``
33
33
bounding boxes in ``[x0, y0, x1, y1]`` format, ranging from ``0``
34
34
to ``W`` and ``0`` to ``H``
35
-
- ``labels (Int64Tensor[N])``: the label for each bounding box
35
+
- ``labels (Int64Tensor[N])``: the label for each bounding box. ``0`` represents always the background class.
36
36
- ``image_id (Int64Tensor[1])``: an image identifier. It should be
37
37
unique between all the images in the dataset, and is used during
38
38
evaluation
@@ -56,6 +56,8 @@ If your model returns the above methods, they will make it work for both
56
56
training and evaluation, and will use the evaluation scripts from
57
57
``pycocotools``.
58
58
59
+
One note on the ``labels``. The model considers class ``0`` as background. If your dataset does not contain the background class, you should not have ``0`` in your ``labels``. For example, assuming you have just two classes, *cat* and *dog*, you can define ``1`` (not ``0``) to represent *cats* and ``2`` to represent *dogs*. So, for instance, if one of the images has booth classes, your ``labels`` tensor should look like ``[1,2]``.
60
+
59
61
Additionally, if you want to use aspect ratio grouping during training
60
62
(so that each batch only contains images with similar aspect ratio),
61
63
then it is recommended to also implement a ``get_height_and_width``
0 commit comments