question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example request: Expand object detection predictions to the original image

See original GitHub issue

What is the task? Object detection

Is this example for a specific model? Not as far as I can tell. What I am wondering about is how to adapt results from the inference phase of the object detection scenario to be displayable over the original image as opposed to transformed sample. Here’s is some code to illustrate

def predict_from_url(image_url):
    # this is just a helper defined previously
    img = image_from_url(image_url)

    infer_tfms = tfms.A.Adapter([*tfms.A.resize_and_pad(384), tfms.A.Normalize()])
    infer_ds = Dataset.from_images([img], infer_tfms)
    infer_dl = faster_rcnn.infer_dl(infer_ds, batch_size=1)
    
    batch, samples = faster_rcnn.build_infer_batch(infer_ds)
    preds = faster_rcnn.predict(model=model, batch=batch)

    imgs = [sample["img"] for sample in samples]
  
    # This works as expected for a sample which are transformed original image (resized and padded)
    #  I would like to understand how to transform BBox'es returned in predictions so i can overlay them over the 
    #  original image 
    show_preds(
        samples=imgs,
        preds=preds,
        class_map=data_class_map,
        denormalize_fn=denormalize_imagenet,
        show=True,
    )

Don’t remove Main issue for examples: #39

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lgvazcommented, May 26, 2021

@tumbleintoyourheart not right now, but I’m sure other people will have in the community. Join the discord server and ask there =)

0reactions
FraPochetticommented, Dec 18, 2021

This currently works thanks to the end2end_detect function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get predictions from a image object detection model | Vertex AI
This page shows you how to get online (real-time) predictions and batch predictions from your image object detection models using the Google Cloud...
Read more >
Object detection with neural networks — a simple tutorial ...
A very lightweight tutorial to object detection in images. ... and measures the overlap between the predicted and the real bounding box.
Read more >
Chapter 4. Object Detection and Image Segmentation - O'Reilly
An image traverses them only once to produce detections. Another approach is to use a first neural network to suggest potential locations for...
Read more >
Object detection: Bounding box regression with Keras ...
Load the original Image from disk with OpenCV and resize it while maintaining aspect ratio (Lines 58 and 59); Scale the predicted bounding...
Read more >
How to Train an Object Detection Model with Keras
The dimensions of the image then need to be expanded one sample in a dataset and used as input to make a prediction...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found