go-darknet
go-darknet copied to clipboard
add support detecting
need https://github.com/AlexeyAB/darknet/pull/6838 for libdarknet
example:
result, bboxs := darknet.Detect(*imageFile)
if result != -1 {
for _, bbox := range bboxs {
fmt.Println(bbox.Rect, bbox.Confidence, bbox.ObjId)
}
}
Do we really need tight OpenCV integration?
// #cgo windows CPPFLAGS: -IC:/opencv/build/install/include
// #cgo windows LDFLAGS: -LC:/opencv/build/install/x64/mingw/lib -lopencv_core420 -lopencv_face420 -lopencv_videoio420 -lopencv_imgproc420 -lopencv_highgui420 -lopencv_imgcodecs420 -lopencv_objdetect420 -lopencv_features2d420 -lopencv_video420 -lopencv_dnn420 -lopencv_xfeatures2d420 -lopencv_plot420 -lopencv_tracking420 -lopencv_img_hash420 -lopencv_calib3d420
although, you can get image.Image by using this GoCV method: https://godoc.org/gocv.io/x/gocv#Mat.ToImage then you can convert it do DarknetImage https://github.com/LdDl/go-darknet/blob/master/image.go#L61
pseudocode:
gocvMat := gocv.NewMat()
stdMat := gocvMat.ToImage()
darknetImage := darknet.Image2Float32(stdMat)
Do we really need tight OpenCV integration?
// #cgo windows CPPFLAGS: -IC:/opencv/build/install/include // #cgo windows LDFLAGS: -LC:/opencv/build/install/x64/mingw/lib -lopencv_core420 -lopencv_face420 -lopencv_videoio420 -lopencv_imgproc420 -lopencv_highgui420 -lopencv_imgcodecs420 -lopencv_objdetect420 -lopencv_features2d420 -lopencv_video420 -lopencv_dnn420 -lopencv_xfeatures2d420 -lopencv_plot420 -lopencv_tracking420 -lopencv_img_hash420 -lopencv_calib3d420although, you can get image.Image by using this GoCV method: https://godoc.org/gocv.io/x/gocv#Mat.ToImage then you can convert it do DarknetImage https://github.com/LdDl/go-darknet/blob/master/image.go#L61
pseudocode:
gocvMat := gocv.NewMat() stdMat := gocvMat.ToImage() darknetImage := darknet.Image2Float32(stdMat)
gocv can't work without opencv libs.
I will test, imho direct using mat will be faster, then converting
Do we really need tight OpenCV integration?
// #cgo windows CPPFLAGS: -IC:/opencv/build/install/include // #cgo windows LDFLAGS: -LC:/opencv/build/install/x64/mingw/lib -lopencv_core420 -lopencv_face420 -lopencv_videoio420 -lopencv_imgproc420 -lopencv_highgui420 -lopencv_imgcodecs420 -lopencv_objdetect420 -lopencv_features2d420 -lopencv_video420 -lopencv_dnn420 -lopencv_xfeatures2d420 -lopencv_plot420 -lopencv_tracking420 -lopencv_img_hash420 -lopencv_calib3d420although, you can get image.Image by using this GoCV method: https://godoc.org/gocv.io/x/gocv#Mat.ToImage then you can convert it do DarknetImage https://github.com/LdDl/go-darknet/blob/master/image.go#L61 pseudocode:
gocvMat := gocv.NewMat() stdMat := gocvMat.ToImage() darknetImage := darknet.Image2Float32(stdMat)gocv can't work without opencv libs.
I will test, imho direct using mat will be faster, then converting
gocv can't work without opencv libs.
I know about it :) You can check current workflow around mat/float32/raw bytes here: https://github.com/LdDl/odam