Spaces:
Running
on
Zero
Running
on
Zero
remove unused functions
Browse files- app.py +1 -3
- inference/inference.py +2 -2
- utils.py +0 -19
app.py
CHANGED
@@ -2,15 +2,13 @@ import gradio as gr
|
|
2 |
import open3d_zerogpu_fix
|
3 |
import spaces
|
4 |
import re
|
5 |
-
from utils import read_pcd, render_point_cloud, render_pcd_file, set_seed
|
6 |
from inference.utils import get_legend
|
7 |
from inference.inference import segment_obj, get_heatmap
|
8 |
from huggingface_hub import login
|
9 |
import os
|
10 |
|
11 |
|
12 |
-
#install_cuda_toolkit()
|
13 |
-
|
14 |
os.chdir("Pointcept/libs/pointops")
|
15 |
os.system("python setup.py install")
|
16 |
os.chdir("../../../")
|
|
|
2 |
import open3d_zerogpu_fix
|
3 |
import spaces
|
4 |
import re
|
5 |
+
from utils import read_pcd, render_point_cloud, render_pcd_file, set_seed
|
6 |
from inference.utils import get_legend
|
7 |
from inference.inference import segment_obj, get_heatmap
|
8 |
from huggingface_hub import login
|
9 |
import os
|
10 |
|
11 |
|
|
|
|
|
12 |
os.chdir("Pointcept/libs/pointops")
|
13 |
os.system("python setup.py install")
|
14 |
os.chdir("../../../")
|
inference/inference.py
CHANGED
@@ -77,7 +77,7 @@ def get_heatmap_rgb(model, data, N_CHUNKS=5): # evaluate loader can only have ba
|
|
77 |
heatmap_rgb = torch.tensor(plt.cm.jet(scores.numpy())[:,:3]).squeeze()
|
78 |
return heatmap_rgb
|
79 |
|
80 |
-
|
81 |
def segment_obj(xyz, rgb, normal, queries):
|
82 |
model = load_model()
|
83 |
data_dict = preprocess_pcd(torch.tensor(xyz).float().to(DEVICE), torch.tensor(rgb).float().to(DEVICE), torch.tensor(normal).float().to(DEVICE))
|
@@ -85,7 +85,7 @@ def segment_obj(xyz, rgb, normal, queries):
|
|
85 |
seg_rgb = get_segmentation_rgb(model, data_dict)
|
86 |
return seg_rgb
|
87 |
|
88 |
-
|
89 |
def get_heatmap(xyz, rgb, normal, query):
|
90 |
model = load_model()
|
91 |
data_dict = preprocess_pcd(torch.tensor(xyz).float().to(DEVICE), torch.tensor(rgb).float().to(DEVICE), torch.tensor(normal).float().to(DEVICE))
|
|
|
77 |
heatmap_rgb = torch.tensor(plt.cm.jet(scores.numpy())[:,:3]).squeeze()
|
78 |
return heatmap_rgb
|
79 |
|
80 |
+
|
81 |
def segment_obj(xyz, rgb, normal, queries):
|
82 |
model = load_model()
|
83 |
data_dict = preprocess_pcd(torch.tensor(xyz).float().to(DEVICE), torch.tensor(rgb).float().to(DEVICE), torch.tensor(normal).float().to(DEVICE))
|
|
|
85 |
seg_rgb = get_segmentation_rgb(model, data_dict)
|
86 |
return seg_rgb
|
87 |
|
88 |
+
|
89 |
def get_heatmap(xyz, rgb, normal, query):
|
90 |
model = load_model()
|
91 |
data_dict = preprocess_pcd(torch.tensor(xyz).float().to(DEVICE), torch.tensor(rgb).float().to(DEVICE), torch.tensor(normal).float().to(DEVICE))
|
utils.py
CHANGED
@@ -4,25 +4,6 @@ import numpy as np
|
|
4 |
import textwrap
|
5 |
import torch
|
6 |
import random
|
7 |
-
import os
|
8 |
-
import subprocess
|
9 |
-
|
10 |
-
def install_cuda_toolkit():
|
11 |
-
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
12 |
-
#CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
13 |
-
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
14 |
-
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
15 |
-
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
16 |
-
subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
|
17 |
-
|
18 |
-
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
19 |
-
os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
|
20 |
-
os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
|
21 |
-
os.environ["CUDA_HOME"],
|
22 |
-
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
23 |
-
)
|
24 |
-
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
25 |
-
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
26 |
|
27 |
def set_seed():
|
28 |
seed = 123
|
|
|
4 |
import textwrap
|
5 |
import torch
|
6 |
import random
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
def set_seed():
|
9 |
seed = 123
|