imsoo / fight_detection

Real time Fight Detection Based on 2D Pose Estimation and RNN Action Recognition
MIT License
193 stars 42 forks source link

could no find yolo_v2_class.cpp #1

Closed jiaszhang closed 4 years ago

imsoo commented 4 years ago

@jiaszhang Hi,

yolo_v2_class.cpp is part of darknet (https://github.com/AlexeyAB/darknet)

this project use darknet SO libraries. See below for make SO library

## get darknet
git clone https://github.com/AlexeyAB/darknet
cd darknet

## add some code in yolo_v2_class.cpp
vi src/yolo_v2_class.cpp
## add below Detector::get_net_height() member function definition
LIB_API int Detector::get_net_out_width() const {
    detector_gpu_t &detector_gpu = *static_cast<detector_gpu_t *>(detector_gpu_ptr.get());
    return detector_gpu.net.layers[detector_gpu.net.n - 2].out_w;
}
LIB_API int Detector::get_net_out_height() const {
    detector_gpu_t &detector_gpu = *static_cast<detector_gpu_t *>(detector_gpu_ptr.get());
    return detector_gpu.net.layers[detector_gpu.net.n - 2].out_h;
}
LIB_API float *Detector::predict(float *input) const {
    detector_gpu_t &detector_gpu = *static_cast<detector_gpu_t *>(detector_gpu_ptr.get());
    return network_predict(detector_gpu.net, input);
}

## add some code in yolo_v2_class.hpp
vi include/yolo_v2_class.hpp
## add below Detector::get_net_height() member function declaration
LIB_API int get_net_out_width() const;
LIB_API int get_net_out_height() const;
LIB_API float *predict(float *input) const;

## Build a library darknet.so
vi Makefile   ## set option LIBSO = 1
make          ## build a library darknet.so
sudo cp libdarknet.so /usr/local/lib/