shin0624 commited on
Commit
e7ee472
ยท
verified ยท
1 Parent(s): ba7391b

Delete gaussian_pipeline.py

Browse files
Files changed (1) hide show
  1. gaussian_pipeline.py +0 -37
gaussian_pipeline.py DELETED
@@ -1,37 +0,0 @@
1
- from spaces import GPU # Hugging Face Spaces์—์„œ GPU ์‚ฌ์šฉ
2
- from ultralytics import YOLO
3
- import numpy as np
4
- import cv2
5
- import os
6
- import trimesh
7
-
8
- @GPU()
9
- def reconstruct_3d_from_yolo(frames, output_dir, device="cuda"):
10
- model = YOLO("yolov8n.pt") # ๊ฒฝ๋Ÿ‰ ๋ชจ๋ธ ์‚ฌ์šฉ
11
-
12
- points_3d = []
13
-
14
- for idx, frame_path in enumerate(frames):
15
- image = cv2.imread(frame_path)
16
- if image is None:
17
- continue
18
-
19
- results = model(image)[0]
20
-
21
- for box in results.boxes.xywh: # ์ค‘์‹ฌ ์ขŒํ‘œ (x_center, y_center, width, height)
22
- x, y, w, h = box[:4].cpu().numpy()
23
- z = idx * 10 # ํ”„๋ ˆ์ž„ ์ˆœ์„œ์— ๋”ฐ๋ผ z๊ฐ’ ์ฆ๊ฐ€์‹œ์ผœ ๊ฐ€์ƒ์˜ ๊นŠ์ด ๋ถ€์—ฌ
24
- points_3d.append([x, y, z])
25
-
26
- if not points_3d:
27
- raise ValueError("No valid YOLO 3D points were reconstructed.")
28
-
29
- all_points = np.array(points_3d)
30
- mesh = trimesh.points.PointCloud(all_points)
31
-
32
- os.makedirs(output_dir, exist_ok=True)
33
- output_model_path = os.path.join(output_dir, "yolo_3d_model.obj")
34
- mesh.export(output_model_path)
35
-
36
- return output_model_path
37
-