Skip to content

Issues running pytorch_detection_training [BUG] #36

@BengineerZ

Description

@BengineerZ

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 20.04
  • FiftyOne installed from (pip or source): pip
  • FiftyOne version (run fiftyone --version): FiftyOne v0.14.4, Voxel51, Inc.
  • Python version: Python 3.9.7
  • Pytorch Version: 1.10.2

Commands to reproduce

Running: pytorch_detection_training.ipynb

Describe the problem

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/tmp/ipykernel_55225/1027263620.py in <module>
      1 # do_training(model, torch_dataset, torch_dataset_test, num_epochs=4)
----> 2 evaluate(model, data_loader, device="cuda")

~/anaconda3/envs/test/lib/python3.9/site-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs)
     26         def decorate_context(*args, **kwargs):
     27             with self.__class__():
---> 28                 return func(*args, **kwargs)
     29         return cast(F, decorate_context)
     30 

~/Documents/test/object_detection_utils/engine.py in evaluate(model, data_loader, device)
     83     header = "Test:"
     84 
---> 85     coco = get_coco_api_from_dataset(data_loader.dataset)
     86     iou_types = _get_iou_types(model)
     87     coco_evaluator = CocoEvaluator(coco, iou_types)

~/Documents/test/object_detection_utils/coco_utils.py in get_coco_api_from_dataset(dataset)
    201     if isinstance(dataset, torchvision.datasets.CocoDetection):
    202         return dataset.coco
--> 203     return convert_to_coco_api(dataset)
    204 
    205 

~/Documents/test/object_detection_utils/coco_utils.py in convert_to_coco_api(ds)
    158         dataset["images"].append(img_dict)
    159         bboxes = targets["boxes"].clone()
--> 160         bboxes[:, 2:] -= bboxes[:, :2]
    161         bboxes = bboxes.tolist()
    162         labels = targets["labels"].tolist()

IndexError: too many indices for tensor of dimension 1

Reproduce:

evaluate(model, data_loader, device="cuda")

Other info / logs

Include any logs or source code that would be helpful to diagnose the problem.
If including tracebacks, please include the full traceback. Large logs and
files should be attached.

What areas of FiftyOne does this bug affect?

  • App: FiftyOne application issue
  • Core: Core fiftyone Python library issue
  • Server: Fiftyone server issue
  • Examples: Fiftyone examples

Willingness to contribute

The FiftyOne Community encourages bug fix contributions. Would you or another
member of your organization be willing to contribute a fix for this bug to the
FiftyOne codebase?

  • Yes. I can contribute a fix for this bug independently.
  • Yes. I would be willing to contribute a fix for this bug with guidance
    from the FiftyOne community.
  • No. I cannot contribute a bug fix at this time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions