Skip to content

Commit 0f0c2be

Browse files
fix bug which allows label map from initialize params to be used from… (#293)
… reading in a json file.
1 parent 6ed8ac2 commit 0f0c2be

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.16
2+
3+
* bug: Allow supplied ONNX models to use label_map dictionary from json file
4+
15
## 0.7.15
26

37
* enhancement: Enable env variables for model definition

test_unstructured_inference/models/test_supergradients.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ def test_supergradients_model():
1111
model.initialize(
1212
model_path=model_path,
1313
label_map={
14-
0: "Picture",
15-
1: "Caption",
16-
2: "Text",
17-
3: "Formula",
18-
4: "Page number",
19-
5: "Address",
20-
6: "Footer",
21-
7: "Subheadline",
22-
8: "Chart",
23-
9: "Metadata",
24-
10: "Title",
25-
11: "Misc",
26-
12: "Header",
27-
13: "Table",
28-
14: "Headline",
29-
15: "List-item",
30-
16: "List",
31-
17: "Author",
32-
18: "Value",
33-
19: "Link",
34-
20: "Field-Name",
14+
"0": "Picture",
15+
"1": "Caption",
16+
"2": "Text",
17+
"3": "Formula",
18+
"4": "Page number",
19+
"5": "Address",
20+
"6": "Footer",
21+
"7": "Subheadline",
22+
"8": "Chart",
23+
"9": "Metadata",
24+
"10": "Title",
25+
"11": "Misc",
26+
"12": "Header",
27+
"13": "Table",
28+
"14": "Headline",
29+
"15": "List-item",
30+
"16": "List",
31+
"17": "Author",
32+
"18": "Value",
33+
"19": "Link",
34+
"20": "Field-Name",
3535
},
3636
input_shape=(1024, 1024),
3737
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.7.15" # pragma: no cover
1+
__version__ = "0.7.16" # pragma: no cover

unstructured_inference/models/super_gradients.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ def image_processing(
6969
class_id = pred_classes[image_index, i]
7070
prob = pred_scores[image_index, i]
7171
x1, y1, x2, y2 = pred_boxes[image_index, i]
72-
detected_class = self.layout_classes[int(class_id)]
72+
detected_class = self.layout_classes[str(class_id)]
7373
region = LayoutElement.from_coords(
74-
x1,
75-
y1,
76-
x2,
77-
y2,
74+
float(x1),
75+
float(y1),
76+
float(x2),
77+
float(y2),
7878
text=None,
7979
type=detected_class,
80-
prob=prob,
80+
prob=float(prob),
8181
source=Source.SUPER_GRADIENTS,
8282
)
8383
regions.append(cast(LayoutElement, region))

0 commit comments

Comments
 (0)