Skip to content

Commit 8658fcd

Browse files
remove strict
Signed-off-by: Ashwin Vaidya <[email protected]>
1 parent 4a35930 commit 8658fcd

File tree

6 files changed

+10
-15
lines changed

6 files changed

+10
-15
lines changed

model_api/python/model_api/models/classification.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def get_hierarchical_predictions(self, logits: np.ndarray):
262262
predicted_labels.append(label_str)
263263
predicted_scores.append(head_logits[i])
264264

265-
predictions = zip(predicted_labels, predicted_scores, strict=False)
265+
predictions = zip(predicted_labels, predicted_scores)
266266
return self.labels_resolver.resolve_labels(predictions)
267267

268268
def get_multilabel_predictions(self, logits: np.ndarray):
@@ -275,7 +275,7 @@ def get_multilabel_predictions(self, logits: np.ndarray):
275275
scores.append(logits[i])
276276
labels = [self.labels[i] if self.labels else "" for i in indices]
277277

278-
return list(zip(indices, labels, scores, strict=False))
278+
return list(zip(indices, labels, scores))
279279

280280
def get_multiclass_predictions(self, outputs):
281281
if self.embedded_topk:
@@ -286,7 +286,7 @@ def get_multiclass_predictions(self, outputs):
286286
scoresTensor = softmax_numpy(outputs[self.out_layer_names[0]][0])
287287
indicesTensor = [np.argmax(scoresTensor)]
288288
labels = [self.labels[i] if self.labels else "" for i in indicesTensor]
289-
return list(zip(indicesTensor, labels, scoresTensor, strict=False))
289+
return list(zip(indicesTensor, labels, scoresTensor))
290290

291291

292292
def addOrFindSoftmaxAndTopkOutputs(inference_adapter, topk, output_raw_scores):

model_api/python/model_api/models/instance_segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def postprocess(self, outputs, meta):
185185
saliency_maps = [[] for _ in range(len(self.labels))]
186186
else:
187187
saliency_maps = []
188-
for box, confidence, cls, raw_mask in zip(boxes, scores, labels, masks, strict=False):
188+
for box, confidence, cls, raw_mask in zip(boxes, scores, labels, masks):
189189
x1, y1, x2, y2 = box
190190
if (x2 - x1) * (y2 - y1) < 1 or (confidence <= self.confidence_threshold and not has_feature_vector_name):
191191
continue

model_api/python/model_api/models/sam_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def preprocess(self, inputs: dict[str, Any]) -> list[dict[str, Any]]:
137137
) is None:
138138
continue
139139

140-
for prompt, label in zip(prompts, labels, strict=False):
140+
for prompt, label in zip(prompts, labels):
141141
if prompt_name == "bboxes":
142142
point_coords = self.apply_coords(
143143
prompt.reshape(-1, 2, 2),

model_api/python/model_api/models/ssd.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def __call__(self, outputs):
122122
bboxes = outputs[self.bboxes_layer][0]
123123
scores = outputs[self.scores_layer][0]
124124
labels = outputs[self.labels_layer][0]
125-
return [Detection(*bbox, score, label) for label, score, bbox in zip(labels, scores, bboxes, strict=False)]
125+
return [Detection(*bbox, score, label) for label, score, bbox in zip(labels, scores, bboxes)]
126126

127127

128128
class BoxesLabelsParser:
@@ -162,9 +162,7 @@ def __call__(self, outputs):
162162
labels = np.full(len(bboxes), self.default_label, dtype=bboxes.dtype)
163163
labels = labels.squeeze(0)
164164

165-
detections = [
166-
Detection(*bbox, score, label) for label, score, bbox in zip(labels, scores, bboxes, strict=False)
167-
]
165+
detections = [Detection(*bbox, score, label) for label, score, bbox in zip(labels, scores, bboxes)]
168166
return detections
169167

170168

model_api/python/model_api/models/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class DetectionWithLandmarks(Detection):
286286
def __init__(self, xmin, ymin, xmax, ymax, score, id, landmarks_x, landmarks_y):
287287
super().__init__(xmin, ymin, xmax, ymax, score, id)
288288
self.landmarks = []
289-
for x, y in zip(landmarks_x, landmarks_y, strict=False):
289+
for x, y in zip(landmarks_x, landmarks_y):
290290
self.landmarks.append((x, y))
291291

292292

model_api/python/model_api/models/yolo.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@ def postprocess(self, outputs, meta):
569569
y_maxs[keep_nms],
570570
scores[keep_nms],
571571
j[keep_nms],
572-
strict=False,
573572
),
574573
)
575574
)
@@ -584,7 +583,7 @@ def set_strides_grids(self):
584583
hsizes = [self.h // stride for stride in strides]
585584
wsizes = [self.w // stride for stride in strides]
586585

587-
for hsize, wsize, stride in zip(hsizes, wsizes, strides, strict=False):
586+
for hsize, wsize, stride in zip(hsizes, wsizes, strides):
588587
xv, yv = np.meshgrid(np.arange(wsize), np.arange(hsize))
589588
grid = np.stack((xv, yv), 2).reshape(1, -1, 2)
590589
grids.append(grid)
@@ -720,9 +719,7 @@ def _parse_outputs(self, outputs):
720719
x_maxs = transposed_boxes[3]
721720
y_maxs = transposed_boxes[2]
722721

723-
detections = list(
724-
starmap(Detection, zip(x_mins, y_mins, x_maxs, y_maxs, out_scores, out_classes, strict=False))
725-
)
722+
detections = list(starmap(Detection, zip(x_mins, y_mins, x_maxs, y_maxs, out_scores, out_classes)))
726723

727724
return detections
728725

0 commit comments

Comments
 (0)