Views
No views yet
1from ultralytics import YOLO
2from PIL import Image
3
4model = YOLO('NAKSTStudio/yolov8-chess-piece-detection')
5
6img = Image.open('chess_board.jpg').convert('RGB')
7img640 = img.resize((640, 640), Image.LANCZOS) # manually pad if needed
8results = model(img640)
9for result in results:
10 for box in result.boxes:
11 cid = int(box.cls[0])
12 print(f"{cid}: {model.names[cid]}", box.xyxy[0].tolist())| Class ID | Name |
|---|---|
| 0 | board |
| 1 | white_king |
| 2 | white_queen |
| 3 | white_rook |
| 4 | white_bishop |
| 5 | white_knight |
| 6 | white_pawn |
| 7 | black_king |
| 8 | black_queen |
| 9 | black_rook |
| 10 | black_bishop |
| 11 | black_knight |
| 12 | black_pawn |



1@model{yolov8_chess_detection_2025,
2 title={YOLOv8 Chess Piece Detection: Real-Time Chess Vision},
3 author={NAKST Studio},
4 year={2025},
5 howpublished={Hugging Face Hub},
6 url={https://huggingface.co/NAKSTStudio/yolov8-chess-piece-detection}
7}