Spaces:
Build error
Build error
Commit
ยท
97b5aba
1
Parent(s):
c1c8251
fix
Browse files- app.py +5 -5
- helpers.py +2 -2
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import sys
|
|
| 7 |
import csv
|
| 8 |
from monoscene.monoscene import MonoScene
|
| 9 |
|
| 10 |
-
csv.field_size_limit(sys.maxsize)
|
| 11 |
torch.set_grad_enabled(False)
|
| 12 |
|
| 13 |
# pipeline = pipeline(model="anhquancao/monoscene_kitti")
|
|
@@ -28,7 +28,6 @@ img_W, img_H = 1220, 370
|
|
| 28 |
|
| 29 |
def predict(img):
|
| 30 |
img = np.array(img, dtype=np.float32, copy=False) / 255.0
|
| 31 |
-
|
| 32 |
|
| 33 |
normalize_rgb = transforms.Compose(
|
| 34 |
[
|
|
@@ -47,16 +46,17 @@ def predict(img):
|
|
| 47 |
|
| 48 |
pred = model(batch).squeeze()
|
| 49 |
# print(pred.shape)
|
| 50 |
-
pred = majority_pooling(pred, k_size=2)
|
| 51 |
-
fig = draw(pred, batch['
|
| 52 |
|
| 53 |
|
| 54 |
return fig
|
| 55 |
|
|
|
|
|
|
|
| 56 |
description = """
|
| 57 |
MonoScene Demo on SemanticKITTI Validation Set (Sequence 08), which uses the <b>camera parameters of Sequence 08</b>.
|
| 58 |
Due to the <b>CPU-only</b> inference, it might take up to 20s to predict a scene. \n
|
| 59 |
-
The output is <b>downsampled by 2</b> to be able to be rendered in browsers.
|
| 60 |
<b>Darker</b> colors represent the <b>scenery outside the Field of View</b>, i.e. not visible on the image.
|
| 61 |
<center>
|
| 62 |
<a href="https://cv-rits.github.io/MonoScene/">
|
|
|
|
| 7 |
import csv
|
| 8 |
from monoscene.monoscene import MonoScene
|
| 9 |
|
| 10 |
+
# csv.field_size_limit(sys.maxsize)
|
| 11 |
torch.set_grad_enabled(False)
|
| 12 |
|
| 13 |
# pipeline = pipeline(model="anhquancao/monoscene_kitti")
|
|
|
|
| 28 |
|
| 29 |
def predict(img):
|
| 30 |
img = np.array(img, dtype=np.float32, copy=False) / 255.0
|
|
|
|
| 31 |
|
| 32 |
normalize_rgb = transforms.Compose(
|
| 33 |
[
|
|
|
|
| 46 |
|
| 47 |
pred = model(batch).squeeze()
|
| 48 |
# print(pred.shape)
|
| 49 |
+
# pred = majority_pooling(pred, k_size=2)
|
| 50 |
+
fig = draw(pred, batch['fov_mask_1'])
|
| 51 |
|
| 52 |
|
| 53 |
return fig
|
| 54 |
|
| 55 |
+
# The output is <b>downsampled by 2</b> to be able to be rendered in browsers.
|
| 56 |
+
|
| 57 |
description = """
|
| 58 |
MonoScene Demo on SemanticKITTI Validation Set (Sequence 08), which uses the <b>camera parameters of Sequence 08</b>.
|
| 59 |
Due to the <b>CPU-only</b> inference, it might take up to 20s to predict a scene. \n
|
|
|
|
| 60 |
<b>Darker</b> colors represent the <b>scenery outside the Field of View</b>, i.e. not visible on the image.
|
| 61 |
<center>
|
| 62 |
<a href="https://cv-rits.github.io/MonoScene/">
|
helpers.py
CHANGED
|
@@ -188,7 +188,7 @@ def draw(
|
|
| 188 |
fov_mask,
|
| 189 |
# img_size,
|
| 190 |
# f,
|
| 191 |
-
voxel_size=0.
|
| 192 |
# d=7, # 7m - determine the size of the mesh representing the camera
|
| 193 |
):
|
| 194 |
|
|
@@ -254,7 +254,7 @@ def draw(
|
|
| 254 |
# label = fov_voxels[:, 3].flatten()
|
| 255 |
fig = go.Figure(data=[go.Scatter3d(x=x, y=y, z=z,mode='markers',
|
| 256 |
marker=dict(
|
| 257 |
-
size=
|
| 258 |
color=pts_colors, # set color to an array/list of desired values
|
| 259 |
# colorscale='Viridis', # choose a colorscale
|
| 260 |
opacity=1.0,
|
|
|
|
| 188 |
fov_mask,
|
| 189 |
# img_size,
|
| 190 |
# f,
|
| 191 |
+
voxel_size=0.2,
|
| 192 |
# d=7, # 7m - determine the size of the mesh representing the camera
|
| 193 |
):
|
| 194 |
|
|
|
|
| 254 |
# label = fov_voxels[:, 3].flatten()
|
| 255 |
fig = go.Figure(data=[go.Scatter3d(x=x, y=y, z=z,mode='markers',
|
| 256 |
marker=dict(
|
| 257 |
+
size=2,
|
| 258 |
color=pts_colors, # set color to an array/list of desired values
|
| 259 |
# colorscale='Viridis', # choose a colorscale
|
| 260 |
opacity=1.0,
|