lddl / go-darknet Goto Github PK
View Code? Open in Web Editor NEWGo bindings for Darknet (YOLO v4 / v7-tiny / v3)
License: Apache License 2.0
Go bindings for Darknet (YOLO v4 / v7-tiny / v3)
License: Apache License 2.0
Hello!
Is there any way to use custom yolov7-tiny models trained with the official PyTorch repo?
I imagine I need to translate from .pt to .weights format, any hint on how to do that?
Describe the bug
First of all, thanks for this repo! You've done a lot of amazing work that I'm excited to use!
I am not sure if this is a bug or a mismatch in system compatibilities. It could also just be some github hiccup and in that case, my apologies for posting this here but I would appreciate any help! The issue seems to be that the reference to darknet repo at commit f056fc3b6a11528fa0522a468eca1e909b7004b7
is not a tree.
Command:
make install_darknet
Result:
rm -rf /tmp/install_darknet
mkdir /tmp/install_darknet
git clone https://github.com/AlexeyAB/darknet.git /tmp/install_darknet
Cloning into '/tmp/install_darknet'...
remote: Enumerating objects: 15386, done.
remote: Total 15386 (delta 0), reused 0 (delta 0), pack-reused 15386
Receiving objects: 100% (15386/15386), 14.01 MiB | 2.00 MiB/s, done.
Resolving deltas: 100% (10345/10345), done.
cd /tmp/install_darknet
git checkout f056fc3b6a11528fa0522a468eca1e909b7004b7
fatal: reference is not a tree: f056fc3b6a11528fa0522a468eca1e909b7004b7
make: *** [download_darknet] Error 128
To Reproduce
git clone [email protected]:LdDl/go-darknet.git
cd go-darknet/
make install_darknet
Expected behavior
Darknet compiles correctly
Describe the solution you'd like and provide pseudocode examples if you can
If there are any workarounds to this issue on my system or glaring git mishaps occurring, I would love to know more in hopes that this issue helps others encountering this issue.
EDIT:
I just went back over the README and noticed a potential issue. It states that the most recent battle-tested commit of the forked darknet is what go-darknet
is using to build but while taking a peek in the Makefile, the LATEST_COMMIT
variable is set to f056fc3b6a11528fa0522a468eca1e909b7004b7
which is not the same hash as the commit in the README. That hash is d65909fbea471d06e52a2e4a41132380dc2edaa6
and when attempting to change the LATEST_COMMIT
variable to this hash, I get the same issue.
EDIT:
The trouble command is when the Makefile runs git checkout $(LATEST_COMMIT)
but when navigating to the /tmp/install_darknet
directory and running the command manually, it switches refs just fine.
Is your feature request related to a problem? Please describe.
Latest commit I've used: f056fc3b6a11528fa0522a468eca1e909b7004b7
But there is a new stable release of YOLO v4 (29th October 2021):
https://github.com/AlexeyAB/darknet/releases/tag/yolov4
Describe the solution you'd like and provide pseudocode examples if you can
Need to:
Describe alternatives you've considered and provide pseudocode examples if you can
nope
Additional context
nope
Hi,
Hope you are all well !
It would be interesting to have a docker container for building and linking darknet. Isn't it ?
Cheers,
X
I went into segmentation violation while running detection.
then I located it happened in following line:
network_predict_ptr(n, sized.data);
in line 17, network.c
I simply switch it to network_predict_image(n, sized);
and it works fine
here's the segmentation error that I got before the change
`fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x2 addr=0x7f87d443c000 pc=0x7f8a45518d8f]
runtime stack:
runtime.throw(0x53d64e, 0x2a)
/usr/local/go/src/runtime/panic.go:1116 +0x72
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:679 +0x46a
goroutine 1 [syscall]:
runtime.cgocall(0x4f04f0, 0xc00006dbc0, 0xc00007a028)
/usr/local/go/src/runtime/cgocall.go:133 +0x5b fp=0xc00006db90 sp=0xc00006db58 pc=0x405b3b
github.com/LdDl/go-darknet._Cfunc_perform_network_detect(0x116e1f0, 0xc00007a028, 0x3e80000000000001, 0x3ee666663f000000, 0x0, 0x0, 0x0)
_cgo_gotypes.go:869 +0x4d fp=0xc00006dbc0 sp=0xc00006db90 pc=0x4cd2dd
github.com/LdDl/go-darknet.(*YOLONetwork).Detect.func1(0xc00006de78, 0xc00007a000, 0x0, 0x0)
/home/idx/go/src/github.com/LdDl/go-darknet/network.go:72 +0x117 fp=0xc00006dc30 sp=0xc00006dbc0 pc=0x4cf5b7
github.com/LdDl/go-darknet.(*YOLONetwork).Detect(0xc00006de78, 0xc00007a000, 0xc00007a000, 0x0, 0x0)
/home/idx/go/src/github.com/LdDl/go-darknet/network.go:72 +0x8e fp=0xc00006dd40 sp=0xc00006dc30 pc=0x4cec1e
main.main()
/home/idx/go/src/github.com/LdDl/go-darknet/example/main.go:66 +0x339 fp=0xc00006df88 sp=0xc00006dd40 pc=0x4ef9a9
runtime.main()
/usr/local/go/src/runtime/proc.go:203 +0x1fa fp=0xc00006dfe0 sp=0xc00006df88 pc=0x4353ea
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00006dfe8 sp=0xc00006dfe0 pc=0x45fb71
exit status 2`
Trouble description
There is memory leak in this function
https://github.com/LdDl/go-darknet/blob/master/network.c#L9
lines of code:
https://github.com/LdDl/go-darknet/blob/master/network.c#L17
and
https://github.com/LdDl/go-darknet/blob/master/network.c#L20
Possible soulutions
Must free *X and excess call of get_network_boxes(...) due some development legacy.
Do we have any plans to support Yolo-V5 in this project?
Describe the bug
Darknet built successfully.
The issue occurs when testing the repo with the sample:
go build main.go && ./main --configFile=../yolov4.cfg --weightsFile=../yolov4.weights --imageFile=../sample.jpg
The net builds but fails on the detection step in the network.c
file with the following error:
atal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x537750000 pc=0x442fccd]
Specifically, the code fails on network_predict_ptr(n, sized.data);
.
To Reproduce
Run the example code on mac.
Expected behavior
An image with bounding boxes is generated
Describe the solution you'd like and provide pseudocode examples if you can
It would be nice to know if this is mac related or an OS-agnostic issue. If mac-related, I will perform additional diagnostics. If not then direction towards a solution would be greatly appreciated.
Is your feature request related to a problem? Please describe.
It would be good to have bash/makefile script for installation of darknet.
Describe the solution you'd like and provide pseudocode examples if you can
Prepare build-file (for cpu-only/ cpu+gpu).
Describe alternatives you've considered and provide pseudocode examples if you can
Additional context
I prefer Makefile
Sure this would be good for Linux users.
Additionally we can have *.bat file for Windows users.
Hi,
Hope you are all well !
Is it possible to provide an example of rest api receiving either url or body image ? That would be awesome addition.
Cheers,
X
Describe the bug
#20 4.538 vendor/github.com/LdDl/go-darknet/network.go:61:2: could not determine kind of name for C.free_network_ptr
To Reproduce
Docker: golang:1.15.7-alpine3.13
Run: CGO_ENABLED=1 go install -v -a --installsuffix --ldflags="-s"
Expected behavior
#20 4.538 vendor/github.com/LdDl/go-darknet/network.go:61:2: could not determine kind of name for C.free_network_ptr
Hi,
Again ! :-)
I was wondering if there is a function to crop the content of the bounding box in separate pictures ?
Cheers,
X.
Hello,
I noticed that there's quite a few versions out, but the go.dev site (https://pkg.go.dev/github.com/lddl/go-darknet) still has the broken go.mod file variant, is it at all possible to update this?
While I'm here, I want to say thank you. You made my life so much better with this project, I can't wait to convert my current setup!
Running the example like stated in the readme will produce a "fatal error: unexpected signal during runtime execution.
To Reproduce
cd cmd/examples
./download_data_v4_tiny.sh
go build -o base_example/main base_example/main.go && ./base_example/main --configFile=yolov4-tiny.cfg --weightsFile=yolov4-tiny.weights --imageFile=sample.jpg
go version: go version go1.19 linux/amd64
Expected behavior
Output as expected
Describe the solution you'd like and provide pseudocode examples if you can
Would love to see it working again, a lot of love for this project.
Hey!
Did you also test this on Windows? I just tried implementing this into my Go-Project but it doesn't seem to work. First problem was that he couldn't find the <darknet.h> file. I think I solved this by changing the cgo include paths to the path where the darknet repository is located. on my Windows PC. However when I'm trying to run it, it always exits with status code 3221225781. According to my research this means that some form of dll is missing?
I can't really debug or find out what really causes this issue.
Do you maybe have an idea on how to fix the issue?
Kind regards :)
Describe the bug
Memory doesn't free at the perform_network_detect function. Precisely at the network_predict
and get_network_boxes
calls.
To Reproduce
Software Versions:
go version 1.15.6
go-darknet v1.3.0
Model:
yolov4-tiny.cfg
yolov4_tiny.weights
https://github.com/AlexeyAB/darknet/archive/darknet_yolo_v4_pre.zip
Snnipet:
imgDarknet, err := darknet.Image2Float32(src)
if err != nil {
return nil, err
}
dr, err := Network.Detect(imgDarknet)
if err != nil {
return nil, err
}
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior
Expected behavior
A clear and concise description of what you expected to happen.
Expected behavior
A clear and concise description of what you expected to happen.
Describe the solution you'd like and provide pseudocode examples if you can
A clear and concise description of what you want to happen.
Additional context
Add any other context about the problem here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.