\brief CarsCounting::ParseTrackerSettings
| 6 | /// \brief CarsCounting::ParseTrackerSettings |
| 7 | /// |
| 8 | bool ParseTrackerSettings(const std::string& settingsFile, TrackerSettings& trackerSettings) |
| 9 | { |
| 10 | bool res = false; |
| 11 | |
| 12 | std::cout << "ParseTrackerSettings: " << settingsFile << " ..." << std::endl; |
| 13 | |
| 14 | INIReader reader(settingsFile); |
| 15 | |
| 16 | if (reader.ParseError() >= 0) |
| 17 | { |
| 18 | std::cout << "ParseTrackerSettings - readed" << std::endl; |
| 19 | |
| 20 | trackerSettings = TrackerSettings(); |
| 21 | |
| 22 | // Read tracking settings |
| 23 | auto distType = reader.GetInteger("tracking", "distance_type", -1); |
| 24 | if (distType >= 0 && distType < (int)tracking::DistsCount) |
| 25 | trackerSettings.SetDistance((tracking::DistType)distType); |
| 26 | |
| 27 | auto kalmanType = reader.GetInteger("tracking", "kalman_type", -1); |
| 28 | if (kalmanType >= 0 && kalmanType < (int)tracking::KalmanCount) |
| 29 | trackerSettings.m_kalmanType = (tracking::KalmanType)kalmanType; |
| 30 | |
| 31 | auto filterGoal = reader.GetInteger("tracking", "filter_goal", -1); |
| 32 | if (filterGoal >= 0 && filterGoal < (int)tracking::FiltersCount) |
| 33 | trackerSettings.m_filterGoal = (tracking::FilterGoal)filterGoal; |
| 34 | |
| 35 | auto lostTrackType = reader.GetInteger("tracking", "lost_track_type", -1); |
| 36 | if (lostTrackType >= 0 && lostTrackType < (int)tracking::SingleTracksCount) |
| 37 | trackerSettings.m_lostTrackType = (tracking::LostTrackType)lostTrackType; |
| 38 | |
| 39 | auto matchType = reader.GetInteger("tracking", "match_type", -1); |
| 40 | if (matchType >= 0 && matchType < (int)tracking::MatchCount) |
| 41 | trackerSettings.m_matchType = (tracking::MatchType)matchType; |
| 42 | |
| 43 | trackerSettings.m_useAcceleration = reader.GetInteger("tracking", "use_aceleration", 0) != 0; // Use constant acceleration motion model |
| 44 | trackerSettings.m_dt = static_cast<track_t>(reader.GetReal("tracking", "delta_time", 0.4)); // Delta time for Kalman filter |
| 45 | trackerSettings.m_accelNoiseMag = static_cast<track_t>(reader.GetReal("tracking", "accel_noise", 0.2)); // Accel noise magnitude for Kalman filter |
| 46 | trackerSettings.m_distThres = static_cast<track_t>(reader.GetReal("tracking", "dist_thresh", 0.8)); // Distance threshold between region and object on two frames |
| 47 | trackerSettings.m_minAreaRadiusPix = static_cast<track_t>(reader.GetReal("tracking", "min_area_radius_pix", -1.)); |
| 48 | trackerSettings.m_minAreaRadiusK = static_cast<track_t>(reader.GetReal("tracking", "min_area_radius_k", 0.8)); |
| 49 | trackerSettings.m_maximumAllowedLostTime = reader.GetReal("tracking", "max_lost_time", 1.); // Maximum lost time in seconds |
| 50 | trackerSettings.m_maxTraceLength = reader.GetReal("tracking", "max_trace_len", 2.); // Maximum trace length in seconds |
| 51 | trackerSettings.m_useAbandonedDetection = reader.GetInteger("tracking", "detect_abandoned", 0) != 0; |
| 52 | trackerSettings.m_minStaticTime = reader.GetInteger("tracking", "min_static_time", 5); |
| 53 | trackerSettings.m_maxStaticTime = reader.GetInteger("tracking", "max_static_time", 25); |
| 54 | trackerSettings.m_maxSpeedForStatic = reader.GetInteger("tracking", "max_speed_for_static", 10); |
| 55 | |
| 56 | |
| 57 | // Read detection settings |
| 58 | trackerSettings.m_nnWeights = reader.GetString("detection", "nn_weights", "data/yolov4-tiny_best.weights"); |
| 59 | trackerSettings.m_nnConfig = reader.GetString("detection", "nn_config", "data/yolov4-tiny.cfg"); |
| 60 | trackerSettings.m_classNames = reader.GetString("detection", "class_names", "data/traffic.names"); |
| 61 | trackerSettings.m_confidenceThreshold = static_cast<track_t>(reader.GetReal("detection", "confidence_threshold", 0.5)); |
| 62 | trackerSettings.m_maxCropRatio = static_cast<track_t>(reader.GetReal("detection", "max_crop_ratio", -1)); |
| 63 | trackerSettings.m_maxBatch = reader.GetInteger("detection", "max_batch", 1); |
| 64 | trackerSettings.m_gpuId = reader.GetInteger("detection", "gpu_id", 0); |
| 65 | trackerSettings.m_netType = reader.GetString("detection", "net_type", "YOLOV4"); |
no test coverage detected