Skip to content

implicitron import error when attempting implicitron_volumes.ipynb #1972

@quinnkjones

Description

@quinnkjones

🐛 Bugs / Unexpected behaviors

When attempting to run the implicitron_volumes,ipynb on a local installation in the tutorial an error is produced in the import step,

from typing import Tuple

import matplotlib.animation as animation
import matplotlib.pyplot as plt
import numpy as np
import torch
import tqdm
from IPython.display import HTML
from omegaconf import OmegaConf
from PIL import Image
from pytorch3d.implicitron.dataset.dataset_base import FrameData
from pytorch3d.implicitron.dataset.rendered_mesh_dataset_map_provider import RenderedMeshDatasetMapProvider
from pytorch3d.implicitron.models.generic_model import GenericModel
from pytorch3d.implicitron.models.implicit_function.base import ImplicitFunctionBase, ImplicitronRayBundle
from pytorch3d.implicitron.models.renderer.base import EvaluationMode
from pytorch3d.implicitron.tools.config import get_default_args, registry, remove_unused_components
from pytorch3d.renderer.implicit.renderer import VolumeSampler
from pytorch3d.structures import Volumes
from pytorch3d.vis.plotly_vis import plot_batch_individually, plot_scene

causes the following error in bbox_xywh_to_xyxy

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[4], line 12
     10 from omegaconf import OmegaConf
     11 from PIL import Image
---> 12 from pytorch3d.implicitron.dataset.dataset_base import FrameData
     13 from pytorch3d.implicitron.dataset.rendered_mesh_dataset_map_provider import RenderedMeshDatasetMapProvider
     14 from pytorch3d.implicitron.models.generic_model import GenericModel

File [~/pytorch3d/pytorch3d/implicitron/dataset/dataset_base.py:25](http://localhost:8080/home/qjones/pytorch3d/pytorch3d/implicitron/dataset/dataset_base.py#line=24)
     11 from typing import (
     12     ClassVar,
     13     Dict,
   (...)
     20     Type,
     21 )
     23 import torch
---> 25 from pytorch3d.implicitron.dataset.frame_data import FrameData
     26 from pytorch3d.implicitron.dataset.utils import GenericWorkaround
     29 @dataclass(eq=False)
     30 class DatasetBase(GenericWorkaround, torch.utils.data.Dataset[FrameData]):

File [~/pytorch3d/pytorch3d/implicitron/dataset/frame_data.py:30](http://localhost:8080/home/qjones/pytorch3d/pytorch3d/implicitron/dataset/frame_data.py#line=29)
     27 import torch
     29 from pytorch3d.implicitron.dataset import orm_types, types
---> 30 from pytorch3d.implicitron.dataset.utils import (
     31     adjust_camera_to_bbox_crop_,
     32     adjust_camera_to_image_scale_,
     33     bbox_xyxy_to_xywh,
     34     clamp_box_to_image_bounds_and_round,
     35     crop_around_box,
     36     GenericWorkaround,
     37     get_bbox_from_mask,
     38     get_clamp_bbox,
     39     load_depth,
     40     load_depth_mask,
     41     load_image,
     42     load_mask,
     43     load_pointcloud,
     44     rescale_bbox,
     45     resize_image,
     46     safe_as_tensor,
     47 )
     48 from pytorch3d.implicitron.tools.config import registry, ReplaceableBase
     49 from pytorch3d.renderer.camera_utils import join_cameras_as_batch

File [~/pytorch3d/pytorch3d/implicitron/dataset/utils.py:149](http://localhost:8080/home/qjones/pytorch3d/pytorch3d/implicitron/dataset/utils.py#line=148)
    145     xywh = torch.cat([xyxy[:2], wh])
    146     return xywh  # pyre-ignore[7]
--> 149 def bbox_xywh_to_xyxy(xywh: T, clamp_size: float | int | None = None) -> T:
    150     wh = xywh[2:]
    151     if clamp_size is not None:

TypeError: unsupported operand type(s) for |: 'type' and 'type'

Instructions To Reproduce the Issue:

Run the cells of implicitron_volumes sequentially using the "restart and

Please include the following (depending on what the issue is):

  1. Any changes you made (git diff) or code you wrote
    no changes
  2. na
  3. What you observed (including the full logs):
    Full logs above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions