Spaces:
Sleeping
Sleeping
Commit ·
25ba4d0
1
Parent(s): 0fb3da6
fix point mismatch
Browse files
app.py
CHANGED
|
@@ -7,10 +7,18 @@ from torch_geometric.utils import to_dense_batch
|
|
| 7 |
from model import HierarchicalFPSCliffordNet
|
| 8 |
|
| 9 |
# --- SAF PYTORCH C++ YEDEKLERİ ---
|
|
|
|
| 10 |
def knn_pure(x, y, k=3):
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
_, topk_idx = torch.topk(dist, k, dim=1, largest=False)
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
def radius_graph_pure(pos, r, max_n=16):
|
| 16 |
dist = torch.cdist(pos, pos)
|
|
@@ -45,8 +53,6 @@ except: print("Ağırlıklar bulunamadı.")
|
|
| 45 |
def predict(file, category_name):
|
| 46 |
if not file: return None
|
| 47 |
|
| 48 |
-
# DÜZELTME: Gradio 6.0'da gr.Model3D doğrudan string (dosya yolu) döndürür.
|
| 49 |
-
# Güvenceye almak için tip kontrolü yapıyoruz.
|
| 50 |
file_path = file if isinstance(file, str) else file.name
|
| 51 |
|
| 52 |
mesh = trimesh.load(file_path, force='mesh')
|
|
@@ -70,7 +76,6 @@ def predict(file, category_name):
|
|
| 70 |
fig.update_layout(margin=dict(l=0,r=0,b=0,t=0), scene=dict(xaxis=dict(visible=False), yaxis=dict(visible=False), zaxis=dict(visible=False)))
|
| 71 |
return fig
|
| 72 |
|
| 73 |
-
# DÜZELTME: Tema (theme) uyarısını kaldırmak için sade blok tanımı yapıldı.
|
| 74 |
with gr.Blocks() as demo:
|
| 75 |
gr.Markdown("# 🚀 Clifford-Dirac 3D Segmentation (0.15M Params)")
|
| 76 |
with gr.Row():
|
|
|
|
| 7 |
from model import HierarchicalFPSCliffordNet
|
| 8 |
|
| 9 |
# --- SAF PYTORCH C++ YEDEKLERİ ---
|
| 10 |
+
|
| 11 |
def knn_pure(x, y, k=3):
|
| 12 |
+
# DÜZELTME BURADA: X (kaynak: 128) ve Y (hedef: 512)
|
| 13 |
+
# cdist(y, x) diyerek hedef odaklı uzaklık matrisi çıkarıyoruz.
|
| 14 |
+
dist = torch.cdist(y, x)
|
| 15 |
_, topk_idx = torch.topk(dist, k, dim=1, largest=False)
|
| 16 |
+
|
| 17 |
+
idx_y = torch.arange(y.size(0), device=y.device).view(-1, 1).expand(-1, k).reshape(-1)
|
| 18 |
+
idx_x = topk_idx.reshape(-1)
|
| 19 |
+
|
| 20 |
+
# Döndürülen tensör sırası [Hedef İndisleri, Kaynak İndisleri] olarak düzeltildi.
|
| 21 |
+
return torch.stack([idx_y, idx_x], dim=0)
|
| 22 |
|
| 23 |
def radius_graph_pure(pos, r, max_n=16):
|
| 24 |
dist = torch.cdist(pos, pos)
|
|
|
|
| 53 |
def predict(file, category_name):
|
| 54 |
if not file: return None
|
| 55 |
|
|
|
|
|
|
|
| 56 |
file_path = file if isinstance(file, str) else file.name
|
| 57 |
|
| 58 |
mesh = trimesh.load(file_path, force='mesh')
|
|
|
|
| 76 |
fig.update_layout(margin=dict(l=0,r=0,b=0,t=0), scene=dict(xaxis=dict(visible=False), yaxis=dict(visible=False), zaxis=dict(visible=False)))
|
| 77 |
return fig
|
| 78 |
|
|
|
|
| 79 |
with gr.Blocks() as demo:
|
| 80 |
gr.Markdown("# 🚀 Clifford-Dirac 3D Segmentation (0.15M Params)")
|
| 81 |
with gr.Row():
|