GithubHelp home page GithubHelp logo

Comments (18)

prabindh avatar prabindh commented on July 28, 2024 1

The latest tree (specifically, the commit bb33fb5) adds more capabilities to the Arapaho test wrapper. Please check !!! Thanks.

from darknet.

prabindh avatar prabindh commented on July 28, 2024

I need some more feedback on the API (in the header file) for the usage, before I can term it complete. Any inputs ?

from darknet.

prabindh avatar prabindh commented on July 28, 2024

After getting some more feedback on the API, I have updated the code significantly, and it mostly runs, but I have not checked validity of bounding boxes yet. Please see the latest commit tag 3.77,

https://github.com/prabindh/darknet/blob/v3.77/arapaho/test.cpp.

To build arapaho (use latest tag 3.77), just use below command, till I finish the rest of the changes. The GPU/CUDNN flags need to match the build flags for darknet-cpp-shared.

g++ test.cpp arapaho.cpp -DGPU -DCUDNN -I../src/ -I/usr/local/cuda/include/ -L./ -ldarknet-cpp-shared -L/usr/local/lib -lopencv_cudabgsegm -lopencv_cudaobjdetect -lopencv_cudastereo -lopencv_shape -lopencv_stitching -lopencv_cudafeatures2d -lopencv_superres -lopencv_cudacodec -lopencv_videostab -lopencv_cudaoptflow -lopencv_cudalegacy -lopencv_calib3d -lopencv_features2d -lopencv_objdetect -lopencv_highgui -lopencv_videoio -lopencv_photo -lopencv_imgcodecs -lopencv_cudawarping -lopencv_cudaimgproc -lopencv_cudafilters -lopencv_video -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_cudaarithm -lopencv_viz -lopencv_core -lopencv_cudev -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -std=c++11

from darknet.

willard-yuan avatar willard-yuan commented on July 28, 2024

Hi @prabindh

I compiled it by the following as you mentioned above:

g++ test.cpp arapaho.cpp -DGPU -DCUDNN -I../src/ -I/usr/local/cuda/include/ -L../ -ldarknet-cpp-shared -L/usr/local/lib -lopencv_core -lopencv_highgui -I/your cudnn/include -L/your cudnn/cuda/lib64 -lcudnn -std=c++11

from darknet.

D3Nd3R avatar D3Nd3R commented on July 28, 2024

Build and run with following command (without cudnn):
g++ test.cpp arapaho.cpp -DGPU -I../src/ -I/usr/local/cuda/include/ -L../ -ldarknet-cpp-shared -L/usr/local/lib -lopencv_core -lopencv_highgui -std=c++11
LD_LIBRARY_PATH=..
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH export PATH=/usr/local/cuda-8.0/bin:$PATH

Tomorrow I will try to visualize the result of detection.

from darknet.

prabindh avatar prabindh commented on July 28, 2024

Were you able to visualize the result ?

from darknet.

prabindh avatar prabindh commented on July 28, 2024

I have updated the code to use maximum classes correctly. Please use latest tree.

from darknet.

prabindh avatar prabindh commented on July 28, 2024

Announcement: Tag https://github.com/prabindh/darknet/tree/v4.01 is now released, with further compile fixes for Mac and windows, and Arapaho readme. For windows builds please use https://github.com/prabindh/darknet-cpp-windows

from darknet.

D3Nd3R avatar D3Nd3R commented on July 28, 2024

` using ObjTraits = std::pair<int, cv::Rect>;
std::vector ArapahoV2::getObjTraits()
{
int count = 0;
mObjTraits.resize(mNumOfDetectedObj);
for(int i = 0; i < (l.wl.hl.n); ++i)
{
int class1 = max_index(probs[i], l.classes);
float prob = probs[i][class1];
if(prob > threshold && count < mNumOfDetectedObj)
{
cv::Rect rect(
(boxes[i].x - boxes[i].w / 2)mImg.size().width,
(boxes[i].y - boxes[i].h / 2)mImg.size().height,
boxes[i].w
mImg.size().width,
boxes[i].h
mImg.size().height);
mObjTraits[count++] = std::make_pair(class1,rect);
}
}

return mObjTraits;

}
int ArapahoV2::detect(cv::Mat inImg)
{
ArapahoImageBuff imageBuff;
imageBuff.bgr = inImg.data;
imageBuff.w = inImg.size().width;
imageBuff.h = inImg.size().height;
imageBuff.channels = 3;
mImg = inImg;
int numObjects{0};
this->Detect(imageBuff,0.24,0.5,numObjects);
return numObjects;
}

void ArapahoV2::drawResult(cv::Mat img, std::vector traits)
{
for(auto iter = traits.begin(); iter != traits.end(); ++iter)
{
cv::rectangle(img,iter->second,
cv::Scalar(0,255,0),3);
std::string str = std::to_string(iter->first);
cv::putText(img,str,
cv::Point(iter->second.x, iter->second.y),
cv::FONT_HERSHEY_SCRIPT_SIMPLEX,
2,
cv::Scalar(0,255,0),3);

}

} `

from darknet.

prabindh avatar prabindh commented on July 28, 2024

Would you be submitting a patch for this, or do you want me to integrate this after testing ? Thanks !!

from darknet.

D3Nd3R avatar D3Nd3R commented on July 28, 2024

I think it wil be better if you integrate it by yourself

from darknet.

prabindh avatar prabindh commented on July 28, 2024

Ok will do, could you please update results of any testing with OpenCV with this code ? Thx

from darknet.

Efreeto avatar Efreeto commented on July 28, 2024

I'm no @D3Nd3R obviously, but I just wanted to say your bb33fb5 commit has been great, drawing red boxes on my OpenCV windows. Thank you Prabindh!

from darknet.

prabindh avatar prabindh commented on July 28, 2024

@Efreeto Please check latest master, it also adds drawing labels in addition to the rects. Thanks for the encouraging words.

from darknet.

Efreeto avatar Efreeto commented on July 28, 2024

It also works well Prabindh 👍
I just had the need for this actually. Thank you for this Prabindh and Liang!

from darknet.

vg123 avatar vg123 commented on July 28, 2024

thanks for your C++ wrapper I run make command firstly in darknet folder It get build their but when I am running make arapaho ,it is giving me following error.

vishal@user756:~/Desktop/darknet/arapaho$ make arapaho
rm -rf ./arapaho.out	
g++ test.cpp arapaho.cpp -D_DEBUG -I../src/ -I/usr/local/cuda/include/ -L./ -ldarknet-cpp-shared -L/usr/local/lib -lopencv_cudabgsegm -lopencv_cudaobjdetect -lopencv_cudastereo -lopencv_shape -lopencv_stitching -lopencv_cudafeatures2d -lopencv_superres -lopencv_cudacodec -lopencv_videostab -lopencv_cudaoptflow -lopencv_cudalegacy -lopencv_calib3d -lopencv_features2d -lopencv_objdetect -lopencv_highgui -lopencv_videoio -lopencv_photo -lopencv_imgcodecs -lopencv_cudawarping -lopencv_cudaimgproc -lopencv_cudafilters -lopencv_video -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_cudaarithm -lopencv_viz -lopencv_core -lopencv_cudev -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -std=c++11 -o arapaho.out
/usr/bin/ld: cannot find -lopencv_cudabgsegm
/usr/bin/ld: cannot find -lopencv_cudaobjdetect
/usr/bin/ld: cannot find -lopencv_cudastereo
/usr/bin/ld: cannot find -lopencv_shape
/usr/bin/ld: cannot find -lopencv_cudafeatures2d
/usr/bin/ld: cannot find -lopencv_cudacodec
/usr/bin/ld: cannot find -lopencv_cudaoptflow
/usr/bin/ld: cannot find -lopencv_cudalegacy
/usr/bin/ld: cannot find -lopencv_videoio
/usr/bin/ld: cannot find -lopencv_imgcodecs
/usr/bin/ld: cannot find -lopencv_cudawarping
/usr/bin/ld: cannot find -lopencv_cudaimgproc
/usr/bin/ld: cannot find -lopencv_cudafilters
/usr/bin/ld: cannot find -lopencv_cudaarithm
/usr/bin/ld: cannot find -lopencv_viz
/usr/bin/ld: cannot find -lopencv_cudev
collect2: error: ld returned 1 exit status
make: *** [arapaho] Error 1

Please tell me how to resolve it.

from darknet.

vg123 avatar vg123 commented on July 28, 2024

Ok I got the solution I just removed these libraries from Makefile and now my Makefile is this.

# Makefile to build the test-wrapper for Arapaho
# Undefine GPU, CUDNN if darknet was built without these defined. These 2 flags have to match darknet flags.
# https://github.com/prabindh/darknet  #add  -DGPU -DCUDNN after arapaho.cpp and before -D_DEBUG 

arapaho: clean
	g++ test.cpp arapaho.cpp -D_DEBUG -I../src/ -I/usr/local/cuda/include/ -L./ -ldarknet-cpp-shared -L/usr/local/lib  -lopencv_stitching  -lopencv_superres  -lopencv_videostab   -lopencv_calib3d -lopencv_features2d -lopencv_objdetect -lopencv_highgui  -lopencv_photo  -lopencv_video -lopencv_ml -lopencv_imgproc -lopencv_flann   -lopencv_core  -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -std=c++11 -o arapaho.out
	
clean:
	rm -rf ./arapaho.out	
I also removed  `-DGPU -DCUDNN` these as, my system do not have those.

from darknet.

prabindh avatar prabindh commented on July 28, 2024

@vg123 yes, if you do not need OpenCV support (for scaling it is faster) for scaling/rendering, you can remove those. Also remove from darknet build (OPENCV=0).

from darknet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.