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.

Extracting the detected boxes

See original GitHub issue

Issue Description

@YoungminBaek Now that Craft have detected the boxes and saved them into a .txt file, can you add a script to extract/crop the detected boxes into images.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

6reactions
akarazniewiczcommented, Sep 1, 2019

This is trivial, You can use something like this:



# convert bounding shape to bounding box
def bounding_box(points):
            points = points.astype(np.int16)
            x_coordinates, y_coordinates = zip(*points)
            return [(min(x_coordinates), min(y_coordinates)), (max(x_coordinates), max(y_coordinates))]

# detection
bboxes, score_text = test_net(net, image, args.text_threshold, args.link_threshold, args.low_text, args.cuda)

for i, bbs in enumerate(bboxes):
            crop = bounding_box(bbs)
            cropped = image[crop[0][1]:crop[1][1],crop[0][0]:crop[1][0]]
            cv2.imwrite(result_folder + '/res_' + filename + '_cropped_' + str(i) + '.png', cropped)

0reactions
erikestanycommented, Mar 15, 2022

Hi,

I also need to export the detected boxes from the Colab notebook, but I don’t understand how to do it.

With the code suggested by @akarazniewicz, I get this error:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
[<ipython-input-7-b12c4da62a69>](https://localhost:8080/#) in <module>()
      7 
      8 # detection
----> 9 bboxes, score_text = test_net(net, image, args.text_threshold, args.link_threshold, args.low_text, args.cuda)
     10 
     11 for i, bbs in enumerate(bboxes):

NameError: name 'test_net' is not defined

What am I doing wrong?

Thank you so much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

extract the images inside the bounding boxes #23 - GitHub
I am still confused about extracting Bounding boxes as a separate image, ... image_np) # Visualization of the results of a detection.
Read more >
Bounding box extraction using rHOG - ResearchGate
Download scientific diagram | Bounding box extraction using rHOG: extracting oblique shaped ... A robust algorithm for detecting people in overhead views.
Read more >
The extractDetectedObjects Action - SAS Help Center
The extractDetectedObjects action enables you to extract the object detection results from the SAS Deep Learning Toolkit. The extraction can take place in ......
Read more >
Object detection: Bounding box regression with Keras ...
In this tutorial you will learn how to train a custom deep learning model to perform object detection via bounding box regression with...
Read more >
Extraction of images within a bounding box using Tensorflow ...
Below is a snippet from the Tensorflow Object Detection API sample that I am trying to change. I was trying to extract the...
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