MalumaDev commited on
Commit
87f54b3
·
1 Parent(s): 9268a78

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +0 -10
  2. app.py +107 -0
  3. page.md +35 -0
README.md CHANGED
@@ -1,13 +1,3 @@
1
  ---
2
- title: BBBicycles
3
- emoji: 🐨
4
- colorFrom: purple
5
- colorTo: indigo
6
- sdk: gradio
7
- sdk_version: 3.5
8
- app_file: app.py
9
- pinned: false
10
  license: mit
11
  ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
 
 
 
 
 
 
 
 
2
  license: mit
3
  ---
 
 
app.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+
4
+ elements = {
5
+ "Becane": ("data/becane_1_0_2_014/before/img6", "data/becane_1_0_2_014/after/img7", "models/RoadBecane_f.stl"),
6
+ "BTWIN": ("data/btwin_1_26_3_114/before/img0", "data/btwin_1_26_3_114/after/img13", "models/BTWIN.stl"),
7
+ "Classic Road": ("data/croad_4_26_4_112/before/img3", "data/croad_4_26_4_112/after/img7", "models/ClassicRoad.stl"),
8
+ "Domane": ("data/domane_2_0_39_012/before/img6", "data/domane_2_0_39_012/after/img13", "models/domane.stl"),
9
+ "Enduro": ("data/enduro_2_18_18_105/before/img6", "data/enduro_2_18_18_105/after/img10", "models/enduro.stl"),
10
+ "G1": ("data/g1_2_36_14_010/before/img6", "data/g1_2_36_14_010/after/img8", "models/g1.stl"),
11
+ "GBike": ("data/gbike_3_31_8_018/before/img2", "data/gbike_3_31_8_018/after/img8", "models/gbike.stl"),
12
+ "Holland": (
13
+ "data/holland_4_24_18_00/before/img4", "data/holland_4_24_18_00/after/img7", "models/holland.stl"),
14
+ "Huffy": (
15
+ "data/huffy_6_4_35_012/before/img4", "data/huffy_6_4_35_012/after/img12", "models/huffy.stl"),
16
+ "Kuota": (
17
+ "data/kuota_6_5_30_112/before/img4", "data/kuota_6_5_30_112/after/img12", "models/kuota.stl"),
18
+ "MFactory": (
19
+ "data/mfactory_1_17_8_00/before/img4", "data/mfactory_1_17_8_00/after/img12", "models/mfactory.stl"),
20
+ "Mirage": (
21
+ "data/mirage_6_11_36_117/before/img4", "data/mirage_6_11_36_117/after/img12", "models/mirage.stl"),
22
+ "Old Bike": (
23
+ "data/oldbike_3_30_15_100/before/img4", "data/oldbike_3_30_15_100/after/img12", "models/oldbike.stl"),
24
+ "Freeride": (
25
+ "data/freeride_6_24_0_00/before/img4", "data/freeride_6_24_0_00/after/img12", "models/freeride_1Step_f.stl"),
26
+ "RondoRuut": (
27
+ "data/rondo_2_11_39_106/before/img4", "data/rondo_2_11_39_106/after/img12",
28
+ "models/RondoRuutClean_1Step_f.stl"),
29
+ "MTB Ghost": (
30
+ "data/ghost_1_0_4_116/before/img4", "data/ghost_1_0_4_116/after/img12", "models/MTB_Ghost.stl"),
31
+ "Scalpel": (
32
+ "data/scalpel_6_2_12_101/before/img4", "data/scalpel_6_2_12_101/after/img12", "models/scalpel.stl"),
33
+ "Verdona": (
34
+ "data/verdona_1_14_10_118/before/img4", "data/verdona_1_14_10_118/after/img12", "models/verdona.stl"),
35
+ "Vintage": (
36
+ "data/vintage_6_6_33_011/before/img4", "data/vintage_6_6_33_011/after/img12", "models/Vintage.stl"),
37
+ "WBike": (
38
+ "data/wbike_3_19_23_00/before/img4", "data/wbike_3_19_23_00/after/img12", "models/wbike.stl"),
39
+ }
40
+
41
+
42
+ def generate_ui(key):
43
+ img_b, img_a, model = elements[key]
44
+ gr.Markdown("### Before damage")
45
+ with gr.Row():
46
+ with gr.Row():
47
+ with gr.Column(scale=1):
48
+ gr.Markdown("#### Render")
49
+ img_bn = gr.Image(f"{img_b}.png")
50
+ with gr.Column(scale=1):
51
+ gr.Markdown("#### Background")
52
+ img_bb = gr.Image(f"{img_b}_background.png")
53
+ with gr.Column(scale=1):
54
+ gr.Markdown("#### Foreground")
55
+ img_bf = gr.Image(f"{img_b}_foreground.png")
56
+ with gr.Column(scale=1):
57
+ gr.Markdown("#### Segmentation")
58
+ img_bs = gr.Image(f"{img_b}_segmentation.png")
59
+
60
+ gr.Markdown("### After damage")
61
+ with gr.Row():
62
+ with gr.Column(scale=1):
63
+ gr.Markdown("#### Render")
64
+ img_an = gr.Image(f"{img_a}.png")
65
+ with gr.Column(scale=1):
66
+ gr.Markdown("#### Background")
67
+ img_ab = gr.Image(f"{img_a}_background.png")
68
+ with gr.Column(scale=1):
69
+ gr.Markdown("#### Foreground")
70
+ img_af = gr.Image(f"{img_a}_foreground.png")
71
+ with gr.Column(scale=1):
72
+ gr.Markdown("#### Segmentation")
73
+ img_as = gr.Image(f"{img_a}_segmentation.png")
74
+
75
+ model = gr.Model3D(model, label="3D model preview")
76
+ return img_bn, img_bb, img_bf, img_bs, img_an, img_ab, img_af, img_as, model
77
+
78
+
79
+ def get_values(key):
80
+ img_b, img_a, model = elements[key]
81
+ gr.Markdown("### Before damage")
82
+ img_bn = Image.open(f"{img_b}.png")
83
+ img_bb = Image.open(f"{img_b}_background.png")
84
+ img_bf = Image.open(f"{img_b}_foreground.png")
85
+ img_bs = Image.open(f"{img_b}_segmentation.png")
86
+ img_an = Image.open(f"{img_a}.png")
87
+ img_ab = Image.open(f"{img_a}_background.png")
88
+ img_af = Image.open(f"{img_a}_foreground.png")
89
+ img_as = Image.open(f"{img_a}_segmentation.png")
90
+
91
+ return img_bn, img_bb, img_bf, img_bs, img_an, img_ab, img_af, img_as, model
92
+
93
+
94
+ block = gr.Blocks()
95
+
96
+ with block:
97
+ with open("page.md", "r") as f:
98
+ gr.Markdown(f.read())
99
+ first_key = list(elements.keys())[0]
100
+ dropdown = gr.Dropdown(choices=list(elements.keys()), value=first_key, label="Model", interactive=True)
101
+ img_bn, img_bb, img_bf, img_bs, img_an, img_ab, img_af, img_as, model = generate_ui(first_key)
102
+
103
+ dropdown.change(get_values, inputs=[dropdown],
104
+ outputs=[img_bn, img_bb, img_bf, img_bs, img_an, img_ab, img_af,
105
+ img_as, model])
106
+
107
+ block.queue(concurrency_count=40, max_size=20).launch(max_threads=150)
page.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Card for BBBicycles
2
+ ## Dataset Summary
3
+ Bent & Broken Bicycles (BBBicycles) dataset is a benchmark set for the novel task of **damaged object re-identification**, which aims to identify the same object in multiple images even in the presence of breaks, deformations, and missing parts.
4
+ ## Dataset Structure
5
+ The final dataset contains:
6
+
7
+ - Total of 39,200 image
8
+ - 2,800 unique IDs
9
+ - 20 models
10
+ - 140 IDs for each model
11
+
12
+ <table border-collapse="collapse">
13
+ <tr>
14
+ <td><b style="font-size:25px">Information for each ID:</b></td>
15
+ <td><b style="font-size:25px">Information for each render:</b></td>
16
+ </tr>
17
+ <tr>
18
+ <td>
19
+ <ul>
20
+ <li>Model</li>
21
+ <li>Type</li>
22
+ <li>Texture type</li>
23
+ <li>Stickers</li>
24
+ </ul>
25
+ </td>
26
+ <td>
27
+ <ul>
28
+ <li>Background</li>
29
+ <li>Viewing Side</li>
30
+ <li>Focal Length</li>
31
+ <li>Presence of dirt</li>
32
+ </ul>
33
+ </td>
34
+ </tr>
35
+ </table>