From 210cf68e276b8067b8557750354cca78290dc72e Mon Sep 17 00:00:00 2001 From: Mathieu Beligon <mathieu@feedly.com> Date: Tue, 31 Mar 2020 21:18:08 -0400 Subject: [PATCH] [common] (objects) fix: x and y must be at least 0 --- common/polystar/common/models/object.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/polystar/common/models/object.py b/common/polystar/common/models/object.py index aee53bc..f81a0b6 100644 --- a/common/polystar/common/models/object.py +++ b/common/polystar/common/models/object.py @@ -54,8 +54,10 @@ class ObjectFactory: int(float(json["bndbox"]["ymax"])) - int(float(json["bndbox"]["ymin"])), ) + x, y = max(0, x), max(0, y) + if t is not ObjectType.Armor: - return Object(type=t, x=x, y=y, w=w, h=h) + return Object(type=t, x=0, y=0, w=w, h=h) armor_number = int(json["armor_class"]) if json["armor_class"] != "none" else 0 -- GitLab