Run this model with HF Jobs
Run lms7127/table_detr_30ep on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/lms7127/table_detr_30ep. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/lms7127/table_detr_30ep on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use lms7127/table_detr_30ep with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lms7127/table_detr_30ep with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("object-detection", model="lms7127/table_detr_30ep")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForObjectDetection processor = AutoImageProcessor.from_pretrained("lms7127/table_detr_30ep") model = AutoModelForObjectDetection.from_pretrained("lms7127/table_detr_30ep", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files2 unmodified lines34567891011121314151617181920212223242526272829303132333435363738394041424344454647484950512 unmodified lines코드 예시metrics:import osfrom transformers import DetrImageProcessor, DetrForObjectDetectionimport torchimport cv2from PIL import Image, ImageDraw, ImageFontmodel = DetrForObjectDetection.from_pretrained("lms7127/table_detr_30ep")processor = DetrImageProcessor.from_pretrained("lms7127/table_detr_30ep")font_path = os.path.join(cv2.__path__[0],'qt','fonts','DejaVuSans.ttf')#변환할 이미지 목록 불러오기image_path = '/path/to/image'save_path ="/path/to/save"img = Image.open(image_path)inputs = processor(images=img, return_tensors="pt")with torch.no_grad():#추가학습 방지outputs = model(**inputs)# convert outputs (bounding boxes and class logits) to COCO API# let's only keep detections with score > 0.9width, height = img.sizepostprocessed_outputs = processor.post_process_object_detection(outputs,target_sizes=[(height, width)],threshold=0.7)results = postprocessed_outputs[0]draw = ImageDraw.Draw(img)for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):box = [round(i, 2) for i in box.tolist()]class_label = model.config.id2label[label.item()]confidence = round(score.item(), 3)# Draw rectangledraw.rectangle(box, outline="red", width = 5)# Add textfont_size=50font = ImageFont.truetype(font_path, font_size)text = f"{class_label}: {confidence}"text_width, text_height = draw.textsize(text)text_location = [box[0], box[1] - text_height - 4]draw.rectangle([text_location[0], text_location[1], text_location[0] + text_width, text_location[1] + text_height], fill="red")draw.text(text_location, text, fill="white", font=font)img.save(save_path,"JPEG")2 unmodified lines34567891011121314151617181920212223242526272829303132333435363738394041424344454647484950512 unmodified lines코드 예시metrics:import osfrom transformers import DetrImageProcessor, DetrForObjectDetectionimport torchimport cv2from PIL import Image, ImageDraw, ImageFontmodel = DetrForObjectDetection.from_pretrained("lms7127/table_detr_30ep")processor = DetrImageProcessor.from_pretrained("lms7127/table_detr_30ep")font_path = os.path.join(cv2.__path__[0],'qt','fonts','DejaVuSans.ttf')#변환할 이미지 목록 불러오기image_path = '/path/to/image'save_path ="/path/to/save"img = Image.open(image_path)inputs = processor(images=img, return_tensors="pt")with torch.no_grad():#추가학습 방지outputs = model(**inputs)# convert outputs (bounding boxes and class logits) to COCO API# let's only keep detections with score > 0.9width, height = img.sizepostprocessed_outputs = processor.post_process_object_detection(outputs,target_sizes=[(height, width)],threshold=0.7)results = postprocessed_outputs[0]draw = ImageDraw.Draw(img)for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):box = [round(i, 2) for i in box.tolist()]class_label = model.config.id2label[label.item()]confidence = round(score.item(), 3)# Draw rectangledraw.rectangle(box, outline="red", width = 5)# Add textfont_size=50font = ImageFont.truetype(font_path, font_size)text = f"{class_label}: {confidence}"text_width, text_height = draw.textsize(text)text_location = [box[0], box[1] - text_height - 4]draw.rectangle([text_location[0], text_location[1], text_location[0] + text_width, text_location[1] + text_height], fill="red")draw.text(text_location, text, fill="white", font=font)img.save(save_path,"JPEG")
README.md+46-46