We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
First, thanks for making this. It's super useful!
For objects that are very small compared to the total image size, the label might block the object.
I'm currently converting this dataset to TF Records: http://bird.nae-lab.org/dataset/
consider drawing the label over the bounding box.
I would have sent a PR but my editor changed the formatting of the file.
Where's what I did:
# file: overlays/detection_overlay.py ... def draw_bboxes(self, image_bytes, bboxes): """Draw bounding boxes onto image. Args: image_bytes: JPEG image. bboxes (list of tuples): [ (label, xmin, xmax, ymin, ymax), (label, xmin, xmax, ymin, ymax) , .. ] Returns: image_bytes: JPEG image including bounding boxes. """ img = Image.open(io.BytesIO(image_bytes)) draw = ImageDraw.Draw(img) width, height = img.size for bbox in bboxes: label, xmin, xmax, ymin, ymax = self.bboxes_to_pixels(bbox, width, height) draw.rectangle([xmin, ymin, xmax, ymax], outline=self.bbox_color(label)) # draw label over bounding box w, h = self.font.getsize(label) draw.rectangle((xmin, ymin - 2, xmin + w + 4, ymin - h - 4), fill="white") draw.text( (xmin + 2, ymin - h - 4), label, fill=self.bbox_color(label), font=self.font, ) with io.BytesIO() as output: if img.mode in ("RGBA", "P"): img = img.convert("RGB") img.save(output, format="JPEG") output_image = output.getvalue() return output_image
The text was updated successfully, but these errors were encountered:
made a pull request: #18
Sorry, something went wrong.
No branches or pull requests
First, thanks for making this. It's super useful!
The Problem
For objects that are very small compared to the total image size, the label might block the object.
I'm currently converting this dataset to TF Records: http://bird.nae-lab.org/dataset/
Suggestion
consider drawing the label over the bounding box.
A Solution
I would have sent a PR but my editor changed the formatting of the file.
Where's what I did:
The text was updated successfully, but these errors were encountered: