mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Clear truth_idxs between samples (#1870)
* Clear truth_idxs between samples * Move truth_idxs inside loop body after all * Push to truth_idxs even when the box can't be detected; improve formatting
This commit is contained in:
parent
170877da88
commit
e89e28b94e
@ -1125,7 +1125,6 @@ namespace dlib
|
||||
|
||||
const float* out_data = output_tensor.host();
|
||||
|
||||
std::vector<size_t> truth_idxs; truth_idxs.reserve(truth->size());
|
||||
std::vector<intermediate_detection> dets;
|
||||
for (long i = 0; i < output_tensor.num_samples(); ++i)
|
||||
{
|
||||
@ -1140,6 +1139,8 @@ namespace dlib
|
||||
det_thresh_speed_adjust = std::max(det_thresh_speed_adjust,dets[max_num_initial_dets].detection_confidence + options.loss_per_false_alarm);
|
||||
}
|
||||
|
||||
std::vector<size_t> truth_idxs;
|
||||
truth_idxs.reserve(truth->size());
|
||||
|
||||
// The loss will measure the number of incorrect detections. A detection is
|
||||
// incorrect if it doesn't hit a truth rectangle or if it is a duplicate detection
|
||||
@ -1155,6 +1156,7 @@ namespace dlib
|
||||
{
|
||||
// Ignore boxes that can't be detected by the CNN.
|
||||
loss -= options.loss_per_missed_target;
|
||||
truth_idxs.push_back(0);
|
||||
continue;
|
||||
}
|
||||
const size_t idx = (k*output_tensor.nr() + p.y())*output_tensor.nc() + p.x();
|
||||
@ -1241,7 +1243,6 @@ namespace dlib
|
||||
hit_truth_table.assign(hit_truth_table.size(), false);
|
||||
final_dets.clear();
|
||||
|
||||
|
||||
// Now figure out which detections jointly maximize the loss and detection score sum. We
|
||||
// need to take into account the fact that allowing a true detection in the output, while
|
||||
// initially reducing the loss, may allow us to increase the loss later with many duplicate
|
||||
|
Loading…
Reference in New Issue
Block a user