From 18bc88f95651f9d5170c38be370832f393018cfe Mon Sep 17 00:00:00 2001 From: swdee Date: Sun, 20 Apr 2025 15:16:58 +1200 Subject: [PATCH] remove unused code/functions --- example/ppocr/system/system.go | 14 -------------- example/stream/bytetrack.go | 2 -- postprocess/common.go | 10 ---------- postprocess/yolov5-seg.go | 10 ---------- render/segment.go | 13 +------------ 5 files changed, 1 insertion(+), 48 deletions(-) diff --git a/example/ppocr/system/system.go b/example/ppocr/system/system.go index 33c71df..3599abf 100644 --- a/example/ppocr/system/system.go +++ b/example/ppocr/system/system.go @@ -350,17 +350,3 @@ func minInt(nums ...int) int { return min } - -// maxInt finds the max value in a slice of integers -func maxInt(nums ...int) int { - - max := nums[0] - - for _, v := range nums { - if v > max { - max = v - } - } - - return max -} diff --git a/example/stream/bytetrack.go b/example/stream/bytetrack.go index 7b4436b..52793a6 100644 --- a/example/stream/bytetrack.go +++ b/example/stream/bytetrack.go @@ -116,8 +116,6 @@ type Demo struct { process YOLOProcessor // labels are the COCO labels the YOLO model was trained on labels []string - // inputAttrs are the model tensor input attributes - inputAttrs []rknnlite.TensorAttr // limitObjs restricts object detection results to be only those provided limitObjs []string // resizer handles scaling of source image to input tensors diff --git a/postprocess/common.go b/postprocess/common.go index 61618c6..9afd6ca 100644 --- a/postprocess/common.go +++ b/postprocess/common.go @@ -275,16 +275,6 @@ func resizeByOpenCVUint8(inputImage []uint8, inputWidth, inputHeight, boxesNum i } } -func intInSlice(i int, arr []int) bool { - for _, next := range arr { - if i == next { - return true - } - } - - return false -} - // boxReverse scales detection box back to box for use on original image dimensions func boxReverse(pos int, pad int, scale float32) int { return int(float32(pos-pad) / scale) diff --git a/postprocess/yolov5-seg.go b/postprocess/yolov5-seg.go index a595bbe..9bf9e84 100644 --- a/postprocess/yolov5-seg.go +++ b/postprocess/yolov5-seg.go @@ -286,16 +286,6 @@ func (y *YOLOv5Seg) DetectObjects(outputs *rknnlite.Outputs, return res } -func int64InSlice(i int64, arr []int64) bool { - for _, next := range arr { - if i == next { - return true - } - } - - return false -} - // SegmentMask creates segment mask data for object detection results func (y *YOLOv5Seg) SegmentMask(detectObjs DetectionResult, resizer *preprocess.Resizer) SegMask { diff --git a/render/segment.go b/render/segment.go index 7b6e0e6..f6de4e1 100644 --- a/render/segment.go +++ b/render/segment.go @@ -69,18 +69,7 @@ func findTopPoint(approx gocv.PointVector) image.Point { return topPoint } -// isContourInsideBoxRect checks if the bounding box of a contour fits -// inside the bounding box of the detection result plus a pad -func isContourInsideBoxRect(contourRect image.Rectangle, - bbox postprocess.BoxRect, pad int) bool { - - return contourRect.Min.X >= bbox.Left-pad && - contourRect.Min.Y >= bbox.Top-pad && - contourRect.Max.X <= bbox.Right+pad && - contourRect.Max.Y <= bbox.Bottom+pad -} - -// isContourInsideBoxRect checks if the bounding box of a contour fits +// isContourInsideTrackerRect checks if the bounding box of a contour fits // inside the bounding box of the detection result plus a pad func isContourInsideTrackerRect(contourRect image.Rectangle, bbox *tracker.Rect, pad int) bool {