Skip to content

Commit

Permalink
introduce functions to detect build features
Browse files Browse the repository at this point in the history
  • Loading branch information
cenit committed Jul 18, 2019
1 parent 2c4c96f commit b9e7cd3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ build_*/
!build/darknet/YoloWrapper.cs
.fuse*
*.weights
build/*.cmake
build/*.ninja
build/*.txt
build/*.json
build/CMakeFiles/
build/detect_cuda_compute_capabilities.cu

# OS Generated #
.DS_Store*
Expand Down
13 changes: 8 additions & 5 deletions include/yolo_v2_class.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ extern "C" LIB_API int detect_mat(const uint8_t* data, const size_t data_length,
extern "C" LIB_API int dispose();
extern "C" LIB_API int get_device_count();
extern "C" LIB_API int get_device_name(int gpu, char* deviceName);
extern "C" LIB_API bool built_with_cuda();
extern "C" LIB_API bool built_with_cudnn();
extern "C" LIB_API bool built_with_opencv();
extern "C" LIB_API void send_json_custom(char const* send_buf, int port, int timeout);

class Detector {
Expand All @@ -88,7 +91,7 @@ class Detector {

LIB_API void *get_cuda_context();

//LIB_API bool send_json_http(std::vector<bbox_t> cur_bbox_vec, std::vector<std::string> obj_names, int frame_id,
//LIB_API bool send_json_http(std::vector<bbox_t> cur_bbox_vec, std::vector<std::string> obj_names, int frame_id,
// std::string filename = std::string(), int timeout = 400000, int port = 8070);

std::vector<bbox_t> detect_resized(image_t img, int init_w, int init_h, float thresh = 0.2, bool use_mean = false)
Expand Down Expand Up @@ -477,7 +480,7 @@ class Tracker_optflow {
else {
std::cerr << " Warning: new_src_mat.channels() is not: 1, 3 or 4. It is = " << new_src_mat.channels() << " \n";
return;
}
}
update_cur_bbox_vec(_cur_bbox_vec);
}

Expand Down Expand Up @@ -691,7 +694,7 @@ class preview_boxes_t {
};


class track_kalman_t
class track_kalman_t
{
int track_id_counter;
std::chrono::steady_clock::time_point global_last_time;
Expand Down Expand Up @@ -847,7 +850,7 @@ class track_kalman_t


track_kalman_t(int _max_objects = 1000, int _min_frames = 3, float _max_dist = 40, cv::Size _img_size = cv::Size(10000, 10000)) :
max_objects(_max_objects), min_frames(_min_frames), max_dist(_max_dist), img_size(_img_size),
max_objects(_max_objects), min_frames(_min_frames), max_dist(_max_dist), img_size(_img_size),
track_id_counter(0)
{
kalman_vec.resize(max_objects);
Expand Down Expand Up @@ -917,7 +920,7 @@ class track_kalman_t
busy_vec[tst.state_id] = true;
}
else {
//std::cerr << " Didn't find: obj_id = " << find_box.obj_id << ", x = " << find_box.x << ", y = " << find_box.y <<
//std::cerr << " Didn't find: obj_id = " << find_box.obj_id << ", x = " << find_box.x << ", y = " << find_box.y <<
// ", track_id_counter = " << track_id_counter << std::endl;
}

Expand Down
25 changes: 25 additions & 0 deletions src/yolo_v2_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,31 @@ int get_device_count() {
#endif // GPU
}

bool built_with_cuda(){
#ifdef GPU
return true;
#else
return false;
#endif
}

bool built_with_cudnn(){
#ifdef CUDNN
return true;
#else
return false;
#endif
}

bool built_with_opencv(){
#ifdef OPENCV
return true;
#else
return false;
#endif
}


int get_device_name(int gpu, char* deviceName) {
#ifdef GPU
cudaDeviceProp prop;
Expand Down

0 comments on commit b9e7cd3

Please sign in to comment.