repair tabs spaces

This commit is contained in:
Tino Hager
2018-06-27 23:57:54 +02:00
parent 8a504c737d
commit 170cebf8af

View File

@ -85,7 +85,7 @@ YOLODLL_API Detector::Detector(std::string cfg_filename, std::string weight_file
wait_stream = 0;
int old_gpu_index;
#ifdef GPU
check_cuda(cudaGetDevice(&old_gpu_index));
check_cuda( cudaGetDevice(&old_gpu_index) );
#endif
detector_gpu_ptr = std::make_shared<detector_gpu_t>();
@ -122,7 +122,7 @@ YOLODLL_API Detector::Detector(std::string cfg_filename, std::string weight_file
for (j = 0; j < l.classes; ++j) detector_gpu.track_id[j] = 1;
#ifdef GPU
check_cuda(cudaSetDevice(old_gpu_index));
check_cuda( cudaSetDevice(old_gpu_index) );
#endif
}
@ -136,7 +136,7 @@ YOLODLL_API Detector::~Detector()
free(detector_gpu.avg);
for (int j = 0; j < FRAMES; ++j) free(detector_gpu.predictions[j]);
for (int j = 0; j < FRAMES; ++j) if (detector_gpu.images[j].data) free(detector_gpu.images[j].data);
for (int j = 0; j < FRAMES; ++j) if(detector_gpu.images[j].data) free(detector_gpu.images[j].data);
int old_gpu_index;
#ifdef GPU
@ -184,8 +184,8 @@ static image load_image_stb(char *filename, int channels)
for (k = 0; k < c; ++k) {
for (j = 0; j < h; ++j) {
for (i = 0; i < w; ++i) {
int dst_index = i + w * j + w * h*k;
int src_index = k + c * i + c * w*j;
int dst_index = i + w*j + w*h*k;
int src_index = k + c*i + c*w*j;
im.data[dst_index] = (float)data[src_index] / 255.;
}
}
@ -223,7 +223,7 @@ YOLODLL_API std::vector<bbox_t> Detector::detect(image_t img, float thresh, bool
int old_gpu_index;
#ifdef GPU
cudaGetDevice(&old_gpu_index);
if (cur_gpu_id != old_gpu_index)
if(cur_gpu_id != old_gpu_index)
cudaSetDevice(net.gpu_index);
net.wait_stream = wait_stream; // 1 - wait CUDA-stream, 0 - not to wait
@ -291,7 +291,7 @@ YOLODLL_API std::vector<bbox_t> Detector::detect(image_t img, float thresh, bool
}
free_detections(dets, nboxes);
if (sized.data)
if(sized.data)
free(sized.data);
#ifdef GPU
@ -327,9 +327,9 @@ YOLODLL_API std::vector<bbox_t> Detector::tracking_id(std::vector<bbox_t> cur_bb
for (size_t m = 0; m < cur_bbox_vec.size(); ++m) {
bbox_t const& k = cur_bbox_vec[m];
if (i.obj_id == k.obj_id) {
float center_x_diff = (float)(i.x + i.w / 2) - (float)(k.x + k.w / 2);
float center_y_diff = (float)(i.y + i.h / 2) - (float)(k.y + k.h / 2);
unsigned int cur_dist = sqrt(center_x_diff*center_x_diff + center_y_diff * center_y_diff);
float center_x_diff = (float)(i.x + i.w/2) - (float)(k.x + k.w/2);
float center_y_diff = (float)(i.y + i.h/2) - (float)(k.y + k.h/2);
unsigned int cur_dist = sqrt(center_x_diff*center_x_diff + center_y_diff*center_y_diff);
if (cur_dist < max_dist && (k.track_id == 0 || dist_vec[m] > cur_dist)) {
dist_vec[m] = cur_dist;
cur_index = m;
@ -340,7 +340,7 @@ YOLODLL_API std::vector<bbox_t> Detector::tracking_id(std::vector<bbox_t> cur_bb
bool track_id_absent = !std::any_of(cur_bbox_vec.begin(), cur_bbox_vec.end(),
[&i](bbox_t const& b) { return b.track_id == i.track_id && b.obj_id == i.obj_id; });
if (cur_index >= 0 && track_id_absent) {
if (cur_index >= 0 && track_id_absent){
cur_bbox_vec[cur_index].track_id = i.track_id;
cur_bbox_vec[cur_index].w = (cur_bbox_vec[cur_index].w + i.w) / 2;
cur_bbox_vec[cur_index].h = (cur_bbox_vec[cur_index].h + i.h) / 2;