Skip to content
Discussion options

You must be logged in to vote

You can add LoadAnnotations to a test_pipeline, but you'll need to prevent Collect from discarding this information and manually control what's passed into the model's inference call.

This is the code snippet I use to inference manually for this kind of use case where data = dataset[0] for like a CocoDataset:

other_keys = []
for k in data:
    if k not in ["img", "img_metas"]:
        other_keys.append(k)
gt_data = {k: data[k] for k in other_keys}
data = {k: data[k] for k in ["img", "img_metas"]}

# fix inputs
data["img_metas"] = data["img_metas"].data
data["img"] = data["img"].data
if next(model.parameters()).is_cuda:
    device = next(model.parameters()).device
    data = scatter(data, [d…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mai-jingming
Comment options

Answer selected by mai-jingming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants