mirror of
https://github.com/docusealco/docuseal
synced 2026-11-11 07:42:32 -05:00
adjust detections
This commit is contained in:
1 parent
c4fbcc103a
commit
5fec952b8c
2 files changed
+10
-1
No files matched your search
@@ -45,6 +45,9 @@ Metrics/PerceivedComplexity:
|
|||||||
Style/MultipleComparison:
|
Style/MultipleComparison:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Style/NumericPredicate:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Naming/PredicateMethod:
|
Naming/PredicateMethod:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ module Templates
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build_fields_from_detections(detections, image)
|
def build_fields_from_detections(detections, image)
|
||||||
Array.new(detections[:xyxy].shape[0]) do |i|
|
detections[:xyxy].shape[0].times.filter_map do |i|
|
||||||
x1 = detections[:xyxy][i, 0]
|
x1 = detections[:xyxy][i, 0]
|
||||||
y1 = detections[:xyxy][i, 1]
|
y1 = detections[:xyxy][i, 1]
|
||||||
x2 = detections[:xyxy][i, 2]
|
x2 = detections[:xyxy][i, 2]
|
||||||
@@ -92,6 +92,12 @@ module Templates
|
|||||||
x1_norm = x2 / image.width.to_f
|
x1_norm = x2 / image.width.to_f
|
||||||
y1_norm = y2 / image.height.to_f
|
y1_norm = y2 / image.height.to_f
|
||||||
|
|
||||||
|
x1_norm = 1 if x1_norm > 1
|
||||||
|
y1_norm = 1 if y1_norm > 1
|
||||||
|
|
||||||
|
next if x0_norm < 0 || x0_norm > 1
|
||||||
|
next if y0_norm < 0 || y0_norm > 1
|
||||||
|
|
||||||
type_name = ID_TO_CLASS[class_id]
|
type_name = ID_TO_CLASS[class_id]
|
||||||
|
|
||||||
Field.new(
|
Field.new(
|
||||||
|
|||||||
Reference in new issue
Block a user