| 197 | |
| 198 | template <typename detection> |
| 199 | void test_tracking_stuff() |
| 200 | { |
| 201 | print_spinner(); |
| 202 | |
| 203 | |
| 204 | typedef std::vector<labeled_detection<detection> > detections_at_single_time_step; |
| 205 | typedef std::vector<detections_at_single_time_step> track_history; |
| 206 | std::vector<track_history> data; |
| 207 | data.push_back(make_random_tracking_data_for_training<detection>()); |
| 208 | data.push_back(make_random_tracking_data_for_training<detection>()); |
| 209 | data.push_back(make_random_tracking_data_for_training<detection>()); |
| 210 | data.push_back(make_random_tracking_data_for_training<detection>()); |
| 211 | data.push_back(make_random_tracking_data_for_training<detection>()); |
| 212 | |
| 213 | |
| 214 | structural_track_association_trainer trainer; |
| 215 | trainer.set_c(1000); |
| 216 | track_association_function<detection> assoc = trainer.train(data); |
| 217 | |
| 218 | double test_val = test_track_association_function(assoc, data); |
| 219 | DLIB_TEST_MSG( test_val == 1, test_val); |
| 220 | test_val = cross_validate_track_association_trainer(trainer, data, 5); |
| 221 | DLIB_TEST_MSG ( test_val == 1, test_val); |
| 222 | |
| 223 | |
| 224 | |
| 225 | typedef typename detection::track_type track; |
| 226 | std::vector<track> tracks; |
| 227 | |
| 228 | std::vector<detection> dets = make_random_detections<detection>(3); |
| 229 | assoc(tracks, dets); |
| 230 | DLIB_TEST(tracks.size() == 3); |
| 231 | |
| 232 | dets = make_random_detections<detection>(3); |
| 233 | assoc(tracks, dets); |
| 234 | DLIB_TEST(tracks.size() == 3); |
| 235 | |
| 236 | dets = make_random_detections<detection>(3); |
| 237 | assoc(tracks, dets); |
| 238 | DLIB_TEST(tracks.size() == 3); |
| 239 | |
| 240 | dets = make_random_detections<detection>(4); |
| 241 | assoc(tracks, dets); |
| 242 | DLIB_TEST(tracks.size() == 4); |
| 243 | |
| 244 | dets = make_random_detections<detection>(3); |
| 245 | assoc(tracks, dets); |
| 246 | DLIB_TEST(tracks.size() == 4); |
| 247 | unsigned long total_miss = 0; |
| 248 | for (unsigned long i = 0; i < tracks.size(); ++i) |
| 249 | total_miss += tracks[i].time_since_last_association; |
| 250 | DLIB_TEST(total_miss == 1); |
| 251 | |
| 252 | dets = make_random_detections<detection>(3); |
| 253 | assoc(tracks, dets); |
| 254 | DLIB_TEST(tracks.size() == 4); |
| 255 | total_miss = 0; |
| 256 | unsigned long num_zero = 0; |
nothing calls this directly
no test coverage detected