public override void CompareWithGroundTruth(StudentScore groundTruthData) { if (groundTruthData is Student2015Score_SE) { Student2015Score_SE groundTruthData_downcasted = (Student2015Score_SE)groundTruthData; List <NumberOfRoadSignsOnImage> groundTruthRoadSignNumbers = groundTruthData_downcasted.dataForEachRoadSignImage; // prepare all the members this.score = 0; this.others = ""; this.scoreForEachRoadSignImage.Clear(); for (int i = 0; i < groundTruthRoadSignNumbers.Count; i++) { this.scoreForEachRoadSignImage.Add(0); } for (int i = 0; i < this.dataForEachRoadSignImage.Count; i++) { NumberOfRoadSignsOnImage current = this.dataForEachRoadSignImage[i]; NumberOfRoadSignsOnImage gt = groundTruthRoadSignNumbers[i]; this.scoreForEachRoadSignImage[i] = current.CountScore(gt); this.score += this.scoreForEachRoadSignImage[i]; } } else { throw new Exception("Wrong class passed!"); } }
public int CountScore(NumberOfRoadSignsOnImage groundTruth) { int score = 0; score += this.CalculateScoreForPair(this.Warning, groundTruth.Warning); score += this.CalculateScoreForPair(this.Mandatory, groundTruth.Mandatory); score += this.CalculateScoreForPair(this.Prohibition, groundTruth.Prohibition); score += this.CalculateScoreForPair(this.Information, groundTruth.Information); score += this.CheckForBonusPoint(groundTruth); return(score); }
private int CheckForBonusPoint(NumberOfRoadSignsOnImage groundTruth) { int bonus = 0; if ( this.Warning == groundTruth.Warning && this.Mandatory == groundTruth.Mandatory && this.Prohibition == groundTruth.Prohibition && this.Information == groundTruth.Information ) { bonus = 1; } return(bonus); }