Views
No views yet
pip install ultralytics huggingface-hub1from ultralytics import YOLO
2from huggingface_hub import hf_hub_download
3
4# Download model from HuggingFace
5model_path = hf_hub_download(
6 repo_id="leeboykt/albion-online-fiber-detection",
7 filename="model.pt"
8)
9
10# Load the model
11model = YOLO(model_path)
12
13# Run inference on an image
14results = model.predict('screenshot.jpg')
15
16# Process results
17for result in results:
18 boxes = result.boxes # Bounding boxes
19 for box in boxes:
20 print(f"Class: {box.cls}, Confidence: {box.conf}, Coordinates: {box.xyxy}")1from ultralytics import YOLO
2from huggingface_hub import hf_hub_download
3import pyautogui
4from PIL import Image
5
6# Load model
7model_path = hf_hub_download(
8 repo_id="leeboykt/albion-online-fiber-detection",
9 filename="model.pt"
10)
11model = YOLO(model_path)
12
13# Capture screen and detect resources
14screenshot = pyautogui.screenshot()
15results = model.predict(screenshot)
16
17# Get detections
18for result in results:
19 for box in result.boxes:
20 x1, y1, x2, y2 = box.xyxy[0].tolist()
21 confidence = box.conf[0].item()
22 class_id = int(box.cls[0].item())
23
24 print(f"Detected resource at ({x1}, {y1}) with confidence {confidence:.2f}")1from ultralytics import YOLO
2from huggingface_hub import hf_hub_download
3import cv2
4
5# Load model
6model_path = hf_hub_download(
7 repo_id="leeboykt/albion-online-fiber-detection",
8 filename="model.pt"
9)
10model = YOLO(model_path)
11
12# Real-time detection with streaming
13model.predict(source=0, show=True) # Use webcam
14# or
15model.predict(source='video.mp4', show=True) # Use video file(x1, y1, x2, y2) coordinates1@misc{albion-fiber-detection,
2 author = {leeboykt},
3 title = {Albion Online Fiber Detection Model},
4 year = {2024},
5 publisher = {HuggingFace},
6 howpublished = {\url{https://huggingface.co/leeboykt/albion-online-fiber-detection}}
7}