fix: rename min function to avoid conflict with builtin
This commit is contained in:
@@ -330,7 +330,7 @@ func preprocessMath(img image.Image) ([]float32, error) {
|
|||||||
// 计算缩放比例
|
// 计算缩放比例
|
||||||
bounds := img.Bounds()
|
bounds := img.Bounds()
|
||||||
srcW, srcH := bounds.Dx(), bounds.Dy()
|
srcW, srcH := bounds.Dx(), bounds.Dy()
|
||||||
ratio := min(float64(targetW)/float64(srcW), float64(targetH)/float64(srcH))
|
ratio := minFloat(float64(targetW)/float64(srcW), float64(targetH)/float64(srcH))
|
||||||
|
|
||||||
newW := int(float64(srcW) * ratio)
|
newW := int(float64(srcW) * ratio)
|
||||||
newH := int(float64(srcH) * ratio)
|
newH := int(float64(srcH) * ratio)
|
||||||
@@ -464,7 +464,7 @@ func decodeMath(output []float32, outputShape []int64) string {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func min(a, b float64) float64 {
|
func minFloat(a, b float64) float64 {
|
||||||
if a < b {
|
if a < b {
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user