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

Add prefix mmdet to LoadImageFromNDArray #2554

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

Danil328
Copy link
Contributor

@Danil328 Danil328 commented Nov 17, 2023

Motivation

I use mmdeploy in my project.

Modification

There was an error when using a model from the mmyolo repository during image preprocessing, provided that an np.ndarray was supplied as input. If you input the path to the image, everything works fine.

Error reproduction code:

from mmdeploy.apis.utils import build_task_processor
from mmdeploy.utils import get_input_shape, load_config
import torch
import cv2

deploy_cfg = './configs/deploy/detection_tensorrt_dynamic-192x192-960x960.py'
model_cfg = '../mmyolo/configs/yolov5/yolov5_s-v61_syncbn_8xb16-300e_coco.py'
device = 'cuda:0'
backend_model = ['./work_dir/end2end.engine']
image_str = '../mmyolo/demo/demo.jpg'
image_np = cv2.imread(image_str)

# read deploy_cfg and model_cfg
deploy_cfg, model_cfg = load_config(deploy_cfg, model_cfg)

# build task and backend model
task_processor = build_task_processor(model_cfg, deploy_cfg, device)
model = task_processor.build_backend_model(backend_model)

# process input image
input_shape = get_input_shape(deploy_cfg)
model_inputs, _ = task_processor.create_input(image_str, input_shape)  # Success
model_inputs, _ = task_processor.create_input(image_np, input_shape)  # Fails

Error:

KeyError: 'LoadImageFromNDArray is not in the transform registry. Please check whether the value of `LoadImageFromNDArray` is correct or it was registered as expected.

Also I found similar issue - #2197

…ng image preprocessing, provided that an array was supplied as input. If you input the path to the image, everything works fine.
@CLAassistant
Copy link

CLAassistant commented Nov 17, 2023

CLA assistant check
All committers have signed the CLA.

@Danil328
Copy link
Contributor Author

I made minor changes, and I see that the tests are failing for a completely different reason, what should I do in this case?

Copy link
Collaborator

@RunningLeon RunningLeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RunningLeon RunningLeon merged commit 6ff3c93 into open-mmlab:main Dec 14, 2023
23 of 27 checks passed
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

Successfully merging this pull request may close these issues.

3 participants