Spaces:
Runtime error
Runtime error
Jingkang Yang
commited on
Commit
·
9a023ed
1
Parent(s):
4855376
update: app
Browse files
app.py
CHANGED
|
@@ -210,96 +210,96 @@ def greet_scannet(rgb_input, depth_map_input, class_candidates):
|
|
| 210 |
RGB_Semantic_SAM_Mask_gif = 'outputs/RGB_3D_All.mp4'
|
| 211 |
return RGB_Semantic_SAM_2D, RGB_Semantic_SAM_Mask_gif, Depth_map, Depth_Semantic_SAM_2D, Depth_Semantic_SAM_Mask_gif
|
| 212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
with gr.Blocks(analytics_enabled=False) as segrgbd_iface:
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
[
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
],
|
| 292 |
-
[
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
inputs=[Input_RGB_Component, Depth_Map_Input_Component, Class_Candidates_Component],
|
| 298 |
-
outputs=[RGB_Semantic_SAM_Mask_Component, RGB_Semantic_SAM_Mask_3D_Component, Depth_Map_Output_Component, Depth_Semantic_SAM_Mask_Component, Depth_Semantic_SAM_Mask_3D_Component],
|
| 299 |
-
fn=greet_scannet)
|
| 300 |
-
vc_end_btn.click(inputs=[Input_RGB_Component, Depth_Map_Input_Component, Class_Candidates_Component],
|
| 301 |
-
outputs=[RGB_Semantic_SAM_Mask_Component, RGB_Semantic_SAM_Mask_3D_Component, Depth_Map_Output_Component, Depth_Semantic_SAM_Mask_Component, Depth_Semantic_SAM_Mask_3D_Component],
|
| 302 |
-
fn=greet_scannet)
|
| 303 |
|
| 304 |
demo = segrgbd_iface
|
| 305 |
demo.launch()
|
|
|
|
| 210 |
RGB_Semantic_SAM_Mask_gif = 'outputs/RGB_3D_All.mp4'
|
| 211 |
return RGB_Semantic_SAM_2D, RGB_Semantic_SAM_Mask_gif, Depth_map, Depth_Semantic_SAM_2D, Depth_Semantic_SAM_Mask_gif
|
| 212 |
|
| 213 |
+
SHARED_UI_WARNING = f'''### [NOTE] It may be very slow in this shared UI.
|
| 214 |
+
You can duplicate and use it with a paid private GPU.
|
| 215 |
+
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/mmlab-ntu/Segment-Any-RGBD?duplicate=true"><img style="margin-top:0;margin-bottom:0" src="https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-xl-dark.svg" alt="Duplicate Space"></a>
|
| 216 |
+
Alternatively, you can also use the Colab demo on our project page.
|
| 217 |
+
<a style="display:inline-block" href="https://github.com/Jun-CEN/SegmentAnyRGBD/"><img style="margin-top:0;margin-bottom:0" src="https://img.shields.io/badge/Project%20Page-online-brightgreen"></a>
|
| 218 |
+
'''
|
| 219 |
|
| 220 |
with gr.Blocks(analytics_enabled=False) as segrgbd_iface:
|
| 221 |
+
#######t2v#######
|
| 222 |
+
with gr.Tab(label="Dataset: Sailvos3D"):
|
| 223 |
+
with gr.Column():
|
| 224 |
+
with gr.Row():
|
| 225 |
+
# with gr.Tab(label='input'):
|
| 226 |
+
with gr.Column():
|
| 227 |
+
with gr.Row():
|
| 228 |
+
Input_RGB_Component = gr.Image(label = 'RGB_Input', type = 'filepath').style(width=320, height=200)
|
| 229 |
+
Depth_Map_Output_Component = gr.Image(label = "Vis_Depth_Map").style(width=320, height=200)
|
| 230 |
+
with gr.Row():
|
| 231 |
+
Depth_Map_Input_Component = gr.File(label = 'input_Depth_map')
|
| 232 |
+
Component_2D_to_3D_Projection_Parameters = gr.File(label = '2D_to_3D_Projection_Parameters')
|
| 233 |
+
with gr.Row():
|
| 234 |
+
Class_Candidates_Component = gr.Text(label = 'Class_Candidates')
|
| 235 |
+
vc_end_btn = gr.Button("Send")
|
| 236 |
+
with gr.Tab(label='Result'):
|
| 237 |
+
with gr.Row():
|
| 238 |
+
RGB_Semantic_SAM_Mask_Component = gr.Video(label = "RGB_Semantic_SAM_Mask").style(width=320, height=200)
|
| 239 |
+
RGB_Semantic_SAM_Mask_3D_Component = gr.Video(label = "Video_3D_RGB_Semantic_SAM_Mask").style(width=320, height=200)
|
| 240 |
+
with gr.Row():
|
| 241 |
+
Depth_Semantic_SAM_Mask_Component = gr.Video(label = "Depth_Semantic_SAM_Mask").style(width=320, height=200)
|
| 242 |
+
Depth_Semantic_SAM_Mask_3D_Component = gr.Video(label = "Video_3D_Depth_Semantic_SAM_Mask").style(width=320, height=200)
|
| 243 |
+
with gr.Row():
|
| 244 |
+
gr.Markdown("<b> It takes around 2 to 5 minutes to get the final results. The framework initialization, SAM segmentation, zero-shot semantic segmentation and 3D results rendering take long time.</b>")
|
| 245 |
+
gr.Examples(examples=[
|
| 246 |
+
[
|
| 247 |
+
'UI/sailvos3d/ex1/inputs/rgb_000160.bmp',
|
| 248 |
+
'UI/sailvos3d/ex1/inputs/depth_000160.npy',
|
| 249 |
+
'UI/sailvos3d/ex1/inputs/rage_matrices_000160.npz',
|
| 250 |
+
'person, car, motorcycle, truck, bird, dog, handbag, suitcase, bottle, cup, bowl, chair, potted plant, bed, dining table, tv, laptop, cell phone, bag, bin, box, door, road barrier, stick, lamp, floor, wall',
|
| 251 |
+
],
|
| 252 |
+
[
|
| 253 |
+
'UI/sailvos3d/ex2/inputs/rgb_000540.bmp',
|
| 254 |
+
'UI/sailvos3d/ex2/inputs/depth_000540.npy',
|
| 255 |
+
'UI/sailvos3d/ex2/inputs/rage_matrices_000540.npz',
|
| 256 |
+
'person, car, motorcycle, truck, bird, dog, handbag, suitcase, bottle, cup, bowl, chair, potted plant, bed, dining table, tv, laptop, cell phone, bag, bin, box, door, road barrier, stick, lamp, floor, wall',
|
| 257 |
+
]],
|
| 258 |
+
inputs=[Input_RGB_Component, Depth_Map_Input_Component, Component_2D_to_3D_Projection_Parameters, Class_Candidates_Component],
|
| 259 |
+
outputs=[RGB_Semantic_SAM_Mask_Component, RGB_Semantic_SAM_Mask_3D_Component, Depth_Map_Output_Component, Depth_Semantic_SAM_Mask_Component, Depth_Semantic_SAM_Mask_3D_Component],
|
| 260 |
+
fn=greet_sailvos3d)
|
| 261 |
+
vc_end_btn.click(inputs=[Input_RGB_Component, Depth_Map_Input_Component, Component_2D_to_3D_Projection_Parameters, Class_Candidates_Component],
|
| 262 |
+
outputs=[RGB_Semantic_SAM_Mask_Component, RGB_Semantic_SAM_Mask_3D_Component, Depth_Map_Output_Component, Depth_Semantic_SAM_Mask_Component, Depth_Semantic_SAM_Mask_3D_Component],
|
| 263 |
+
fn=greet_sailvos3d)
|
| 264 |
+
|
| 265 |
+
with gr.Tab(label="Dataset: Scannet"):
|
| 266 |
+
with gr.Column():
|
| 267 |
+
with gr.Row():
|
| 268 |
+
# with gr.Tab(label='input'):
|
| 269 |
+
with gr.Column():
|
| 270 |
+
with gr.Row():
|
| 271 |
+
Input_RGB_Component = gr.Image(label = 'RGB_Input', type = 'filepath').style(width=320, height=200)
|
| 272 |
+
Depth_Map_Output_Component = gr.Image(label = "Vis_Depth_Map").style(width=320, height=200)
|
| 273 |
+
with gr.Row():
|
| 274 |
+
Depth_Map_Input_Component = gr.File(label = "Input_Depth_Map")
|
| 275 |
+
Class_Candidates_Component = gr.Text(label = 'Class_Candidates')
|
| 276 |
+
vc_end_btn = gr.Button("Send")
|
| 277 |
+
with gr.Tab(label='Result'):
|
| 278 |
+
with gr.Row():
|
| 279 |
+
RGB_Semantic_SAM_Mask_Component = gr.Video(label = "RGB_Semantic_SAM_Mask").style(width=320, height=200)
|
| 280 |
+
RGB_Semantic_SAM_Mask_3D_Component = gr.Video(label = "Video_3D_RGB_Semantic_SAM_Mask").style(width=320, height=200)
|
| 281 |
+
with gr.Row():
|
| 282 |
+
Depth_Semantic_SAM_Mask_Component = gr.Video(label = "Depth_Semantic_SAM_Mask").style(width=320, height=200)
|
| 283 |
+
Depth_Semantic_SAM_Mask_3D_Component = gr.Video(label = "Video_3D_Depth_Semantic_SAM_Mask").style(width=320, height=200)
|
| 284 |
+
with gr.Row():
|
| 285 |
+
gr.Markdown("<b> It takes around 2 to 5 minutes to get the final results. The framework initialization, SAM segmentation, zero-shot semantic segmentation and 3D results rendering take long time.</b>")
|
| 286 |
+
gr.Examples(examples=[
|
| 287 |
+
[
|
| 288 |
+
'UI/scannetv2/examples/scene0000_00/color/1660.jpg',
|
| 289 |
+
'UI/scannetv2/examples/scene0000_00/depth/1660.png',
|
| 290 |
+
'wall, floor, cabinet, bed, chair, sofa, table, door, window, bookshelf, picture, counter, desk, curtain, refrigerator, shower curtain, toilet, sink, bathtub, other furniture',
|
| 291 |
+
],
|
| 292 |
+
[
|
| 293 |
+
'UI/scannetv2/examples/scene0000_00/color/5560.jpg',
|
| 294 |
+
'UI/scannetv2/examples/scene0000_00/depth/5560.png',
|
| 295 |
+
'wall, floor, cabinet, bed, chair, sofa, table, door, window, bookshelf, picture, counter, desk, curtain, refrigerator, shower curtain, toilet, sink, bathtub, other furniture',
|
| 296 |
+
]],
|
| 297 |
+
inputs=[Input_RGB_Component, Depth_Map_Input_Component, Class_Candidates_Component],
|
| 298 |
+
outputs=[RGB_Semantic_SAM_Mask_Component, RGB_Semantic_SAM_Mask_3D_Component, Depth_Map_Output_Component, Depth_Semantic_SAM_Mask_Component, Depth_Semantic_SAM_Mask_3D_Component],
|
| 299 |
+
fn=greet_scannet)
|
| 300 |
+
vc_end_btn.click(inputs=[Input_RGB_Component, Depth_Map_Input_Component, Class_Candidates_Component],
|
| 301 |
+
outputs=[RGB_Semantic_SAM_Mask_Component, RGB_Semantic_SAM_Mask_3D_Component, Depth_Map_Output_Component, Depth_Semantic_SAM_Mask_Component, Depth_Semantic_SAM_Mask_3D_Component],
|
| 302 |
+
fn=greet_scannet)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
|
| 304 |
demo = segrgbd_iface
|
| 305 |
demo.launch()
|