private static void ValidateSatyamCARPKObjectCountingAggregationResult(List <SatyamAggregatedResultsTableEntry> aggResultEntries, out double totalError, out double totalGroundTruth) { List <double> aggResultCounts = new List <double>(); List <int> GroundTruthCounts = new List <int>(); List <double> abs_errors = new List <double>(); List <double> errors = new List <double>(); foreach (SatyamAggregatedResultsTableEntry aggResultEntry in aggResultEntries) { SatyamSaveAggregatedDataSatyam data = new SatyamSaveAggregatedDataSatyam(aggResultEntry); string fileName = URIUtilities.filenameFromURINoExtension(data.SatyamURI); string labelFilePath = DirectoryConstants.CARPKCountingLabels + fileName + ".txt"; string[] labels = File.ReadAllLines(labelFilePath); int GroundtruthCount = labels.Length; string jobGUID = aggResultEntry.JobGUID; int taskID = aggResultEntry.SatyamTaskTableEntryID; String resultString = data.AggregatedResultString; ObjectCountingAggregatedResult result = JSonUtils.ConvertJSonToObject <ObjectCountingAggregatedResult>(resultString); aggResultCounts.Add(result.Count); GroundTruthCounts.Add(GroundtruthCount); abs_errors.Add(Math.Abs(GroundtruthCount - result.Count)); errors.Add(GroundtruthCount - result.Count); } totalError = abs_errors.Sum(); totalGroundTruth = GroundTruthCounts.Sum(); double totalErrorRatio = totalError / totalGroundTruth; Console.WriteLine("Error: {0} / {1} = {2}", totalError, totalGroundTruth, totalErrorRatio); Console.WriteLine("Total Aggregated {0}", aggResultEntries.Count); }
private static void ValidateSatyamKITTIObjectCountingAggregationResult(List <SatyamAggregatedResultsTableEntry> aggResultEntries, //bool saveImage = false, out double totalError, out double totalGroundTruth, int MinHeight = TaskConstants.OBJECT_COUNTING_VALIDATION_MIN_HEIGHT, int MaxOcclusion = TaskConstants.OBJECT_COUNTING_VALIDATION_MAX_OCCLUSION, double Max_Truncation = TaskConstants.OBJECT_COUNTING_VALIDATION_MIN_TRUNCATION) { List <double> aggResultCounts = new List <double>(); List <int> GroundTruthCounts = new List <int>(); List <double> errors = new List <double>(); foreach (SatyamAggregatedResultsTableEntry aggResultEntry in aggResultEntries) { SatyamSaveAggregatedDataSatyam data = new SatyamSaveAggregatedDataSatyam(aggResultEntry); string fileName = URIUtilities.filenameFromURINoExtension(data.SatyamURI); KITTIDetectionGroundTruth GroundTruthObjects = new KITTIDetectionGroundTruth(KITTIDetectionResultValidation.GroundTruthLabelDirectory + fileName + ".txt", MinHeight, MaxOcclusion, Max_Truncation); string jobGUID = aggResultEntry.JobGUID; int taskID = aggResultEntry.SatyamTaskTableEntryID; String resultString = data.AggregatedResultString; ObjectCountingAggregatedResult result = JSonUtils.ConvertJSonToObject <ObjectCountingAggregatedResult>(resultString); int GroundtruthCount = 0; for (int i = 0; i < GroundTruthObjects.objects.Count; i++) { MultiObjectLocalizationAndLabelingResultSingleEntry obj = GroundTruthObjects.objects[i]; //if (obj.Category == "Car" || obj.Category == "Van" || obj.Category == "DontCare") if (obj.Category == "Car" || obj.Category == "Van") { //if (!GroundTruthObjects.BlackListed[i]) //{ GroundtruthCount++; //} } } aggResultCounts.Add(result.Count); GroundTruthCounts.Add(GroundtruthCount); errors.Add(Math.Abs(GroundtruthCount - result.Count)); } totalError = errors.Sum(); totalGroundTruth = GroundTruthCounts.Sum(); double totalErrorRatio = totalError / totalGroundTruth; Console.WriteLine("Error: {0} / {1} = {2}", totalError, totalGroundTruth, totalErrorRatio); Console.WriteLine("Total Aggregated {0}", aggResultEntries.Count); }