mirror of https://github.com/AlexeyAB/darknet.git
Minor fix
This commit is contained in:
parent
a47422a30e
commit
8872a860b3
|
@ -647,6 +647,14 @@ void validate_detector(char *datacfg, char *cfgfile, char *weightfile, char *out
|
|||
char **paths = (char **)list_to_array(plist);
|
||||
|
||||
layer l = net.layers[net.n - 1];
|
||||
int k;
|
||||
for (k = 0; k < net.n; ++k) {
|
||||
layer lk = net.layers[k];
|
||||
if (lk.type == YOLO || lk.type == GAUSSIAN_YOLO || lk.type == REGION) {
|
||||
l = lk;
|
||||
printf(" Detection layer: %d - type = %d \n", k, l.type);
|
||||
}
|
||||
}
|
||||
int classes = l.classes;
|
||||
|
||||
char buff[1024];
|
||||
|
@ -960,6 +968,14 @@ float validate_detector_map(char *datacfg, char *cfgfile, char *weightfile, floa
|
|||
|
||||
|
||||
layer l = net.layers[net.n - 1];
|
||||
int k;
|
||||
for (k = 0; k < net.n; ++k) {
|
||||
layer lk = net.layers[k];
|
||||
if (lk.type == YOLO || lk.type == GAUSSIAN_YOLO || lk.type == REGION) {
|
||||
l = lk;
|
||||
printf(" Detection layer: %d - type = %d \n", k, l.type);
|
||||
}
|
||||
}
|
||||
int classes = l.classes;
|
||||
|
||||
int m = plist->size;
|
||||
|
@ -1042,7 +1058,8 @@ float validate_detector_map(char *datacfg, char *cfgfile, char *weightfile, floa
|
|||
if (l.nms_kind == DEFAULT_NMS) do_nms_sort(dets, nboxes, l.classes, nms);
|
||||
else diounms_sort(dets, nboxes, l.classes, nms, l.nms_kind, l.beta_nms);
|
||||
}
|
||||
//if (nms) do_nms_obj(dets, nboxes, l.classes, nms);
|
||||
|
||||
//if (l.embedding_size) set_track_id(dets, nboxes, thresh, l.sim_thresh, l.track_ciou_norm, l.track_history_size, l.dets_for_track, l.dets_for_show);
|
||||
|
||||
char labelpath[4096];
|
||||
replace_image_to_label(path, labelpath);
|
||||
|
@ -1628,7 +1645,16 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
|
|||
image sized;
|
||||
if(letter_box) sized = letterbox_image(im, net.w, net.h);
|
||||
else sized = resize_image(im, net.w, net.h);
|
||||
|
||||
layer l = net.layers[net.n - 1];
|
||||
int k;
|
||||
for (k = 0; k < net.n; ++k) {
|
||||
layer lk = net.layers[k];
|
||||
if (lk.type == YOLO || lk.type == GAUSSIAN_YOLO || lk.type == REGION) {
|
||||
l = lk;
|
||||
printf(" Detection layer: %d - type = %d \n", k, l.type);
|
||||
}
|
||||
}
|
||||
|
||||
//box *boxes = calloc(l.w*l.h*l.n, sizeof(box));
|
||||
//float **probs = calloc(l.w*l.h*l.n, sizeof(float*));
|
||||
|
@ -1785,6 +1811,15 @@ void draw_object(char *datacfg, char *cfgfile, char *weightfile, char *filename,
|
|||
image src_sized = copy_image(sized);
|
||||
|
||||
layer l = net.layers[net.n - 1];
|
||||
int k;
|
||||
for (k = 0; k < net.n; ++k) {
|
||||
layer lk = net.layers[k];
|
||||
if (lk.type == YOLO || lk.type == GAUSSIAN_YOLO || lk.type == REGION) {
|
||||
l = lk;
|
||||
printf(" Detection layer: %d - type = %d \n", k, l.type);
|
||||
}
|
||||
}
|
||||
|
||||
net.num_boxes = l.max_boxes;
|
||||
int num_truth = l.truths;
|
||||
float *truth_cpu = (float *)xcalloc(num_truth, sizeof(float));
|
||||
|
|
|
@ -849,7 +849,7 @@ void set_track_id(detection *new_dets, int new_dets_num, float thresh, float sim
|
|||
|
||||
// sort similarity
|
||||
std::sort(sim_det.begin(), sim_det.end(), [](similarity_detections_t v1, similarity_detections_t v2) { return v1.sim > v2.sim; });
|
||||
if(sim_det.size() > 0) printf(" sim_det_first = %f, sim_det_end = %f \n", sim_det.begin()->sim, sim_det.rbegin()->sim);
|
||||
//if(sim_det.size() > 0) printf(" sim_det_first = %f, sim_det_end = %f \n", sim_det.begin()->sim, sim_det.rbegin()->sim);
|
||||
|
||||
|
||||
std::vector<int> new_idx(new_dets_num, 1);
|
||||
|
@ -895,10 +895,11 @@ void set_track_id(detection *new_dets, int new_dets_num, float thresh, float sim
|
|||
|
||||
// remove detection which were detected only on few frames
|
||||
for (int i = 0; i < new_dets_num; ++i) {
|
||||
if (new_dets[i].sort_class < dets_for_show)
|
||||
if (new_dets[i].sort_class < dets_for_show) {
|
||||
for (int j = 0; j < new_dets[i].classes; ++j) {
|
||||
new_dets[i].prob[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue