Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run image_demo.py #58

Open
12314312 opened this issue Dec 2, 2024 · 0 comments
Open

run image_demo.py #58

12314312 opened this issue Dec 2, 2024 · 0 comments

Comments

@12314312
Copy link

12314312 commented Dec 2, 2024

When I use my own picture to run the image_demo.py, it occurs
/OMG-Seg/demo/image_demo.py:68 in │
│ │
│ 65 │ result = results[0] │
│ 66 │ print(result) │
│ 67 │ img = mmcv.imread(result.img_path, channel_order='rgb') │
│ ❱ 68 │ visualizer.add_datasample( │
│ 69 │ │ 'test_img', │
│ 70 │ │ img, │
│ 71 │ │ data_sample=result, │
│ │
│ /usr/local/lib/python3.8/dist-packages/mmengine/dist/utils.py:401 in wrapper │
│ │
│ 398 │ @functools.wraps(func) │
│ 399 │ def wrapper(*args, **kwargs): │
│ 400 │ │ if is_main_process(): │
│ ❱ 401 │ │ │ return func(*args, **kwargs) │
│ 402 │ │
│ 403 │ return wrapper │
│ 404 │
│ │
│ /OMG-Seg/seg/evaluation/hooks/visual_hook.py:294 in add_datasample │
│ │
│ 291 │ │ │ │ │ │ │ │ │ │ │ 'not provided when ' \ │
│ 292 │ │ │ │ │ │ │ │ │ │ │ 'visualizing panoptic ' \ │
│ 293 │ │ │ │ │ │ │ │ │ │ │ 'segmentation results.' │
│ ❱ 294 │ │ │ │ pred_img_data = self._draw_panoptic_seg( │
│ 295 │ │ │ │ │ pred_img_data, data_sample.pred_panoptic_seg.numpy(), │
│ 296 │ │ │ │ │ classes, palette) │
│ 297 │
│ │
│ /mmdetection-3.1.0/mmdet/visualization/local_visualizer.py:300 in _draw_panoptic_seg │
│ │
│ 297 │ │ │ max_id = np.argmax(stats[1:, -1]) + 1 │
│ 298 │ │ │ positions.append(centroids[max_id]) │
│ 299 │ │ │ areas.append(stats[max_id, -1]) │
│ ❱ 300 │ │ areas = np.stack(areas, axis=0) │
│ 301 │ │ scales = _get_adaptive_scales(areas) │
│ 302 │ │ │
│ 303 │ │ text_palette = get_palette(self.text_color, max_label + 1) │
│ in stack:200 │
│ │
│ /usr/local/lib/python3.8/dist-packages/numpy/core/shape_base.py:460 in stack │
│ │
│ 457 │ │
│ 458 │ arrays = [asanyarray(arr) for arr in arrays] │
│ 459 │ if not arrays: │
│ ❱ 460 │ │ raise ValueError('need at least one array to stack') │
│ 461 │ │
│ 462 │ shapes = {arr.shape for arr in arrays} │
│ 463 │ if len(shapes) != 1:
ValueError: need at least one array to stack
sem_seg in image_demo.py is all 240.
sem_seg: tensor([[[240, 240, 240, ..., 240, 240, 240],
[240, 240, 240, ..., 240, 240, 240],
[240, 240, 240, ..., 240, 240, 240],
...,
[240, 240, 240, ..., 240, 240, 240],
[240, 240, 240, ..., 240, 240, 240],
[240, 240, 240, ..., 240, 240, 240]]]
how to solve it ?

@12314312 12314312 changed the title run run image_demo.py Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant