Comments (1)
I don't think TrOcr
for that. All you need is a utility function with opencv
or some other preferred library, like this:
import cv2
def crop_images_from_bounding_boxes(image, bounding_boxes):
"""
Crops images from the original image based on the provided bounding boxes.
Parameters:
image (numpy.ndarray): The original image.
bounding_boxes (list of tuples): A list of bounding boxes, where each bounding box is represented by a tuple
(x, y, width, height).
Returns:
list of numpy.ndarray: A list of cropped images.
"""
cropped_images = []
for (x, y, w, h) in bounding_boxes:
cropped_image = image[y:y+h, x:x+w]
cropped_images.append(cropped_image)
return cropped_images
If you are worried about the performance, be assured that as the images are cropped so it will be faster, at least a bit. And you can you use multi-threading for this, if you don't have a GPU. If you have a GPU, this will be fast as hell.
I hope this answers your question.
from unilm.
Related Issues (20)
- How to fine-tune E5-mistral-7b-instruct? HOT 1
- Kosmo2.5 Chinese performance very bad HOT 2
- why last_hidden_states.sequence_length is not same as input_ids.sequence_length
- Model for commercial use? HOT 1
- Kosmos 2.5 for Volta GPU
- The influence of t (temperature) in the E5 Model paper HOT 4
- (BEIT-3) I can't find transformers.py HOT 3
- Kosmos-2.5 Dependencies Should Be Updated HOT 1
- The pretraining code and model of beit3 HOT 1
- TROCR model weight file cannot be downloaded.
- BEIT3 RuntimeError: Size mismatch when loading checkpoint for BEiT3ForRetrieval model
- Kosmos-2.5 - Deployment Challenges on a Windows 11 + RTX 3090 PC HOT 1
- [BEIT-3] error happens when I evaluate BEiT-3 finetuned model on VQAv2 HOT 4
- Missing Documentation
- Kosmos 2.5 dataset availability
- Kosmos-2.5 - Image-to-markdown generation for images outside the sample-set provided is almost entirely garbled - output markdown is completely unusable.
- Kosmos-2.5 - Python version 3.10.x (and any other confirmed working versions) should be mentioned as a requirement to deploy & infer the Kosmos-2.5 model
- Kosmos-2 batch modality and processing speed
- how to resume training for layoutlmv3-publaynet
- TextDiffuser - SD2.1 code and weights
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unilm.