This commit is contained in:
Amrutha Srinivasan 2021-08-04 22:37:20 -07:00
Родитель 5fd328fa25
Коммит 4339fb1fb9
1 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -68,14 +68,15 @@ namespace IntelligentLabsTest
//Use Squeezenet model to classify image //Use Squeezenet model to classify image
List<ClassificationResult> imageClasses = await SqueezeNetImageClassifier.ClassifyImage(selectedStorageFile, 3); List<ClassificationResult> imageClasses = await SqueezeNetImageClassifier.ClassifyImage(selectedStorageFile, 3);
UpdateTextBox(imageClasses);
//Use YOLOv4 to detect objects. UNCOMMENT THE NEXT 2 LINES IF YOU ARE RUNNING WINDOWS 11!!
//Use YOLOv4 to detect objects //List<DetectionResult> listOfObjects = await YOLOObjectDetector.DetectObjects(selectedStorageFile);
List<DetectionResult> listOfObjects = await YOLOObjectDetector.DetectObjects(selectedStorageFile); //DrawBoxes(listOfObjects);
UpdateTextBox(imageClasses, listOfObjects);
ProgressRing.IsActive = false; ProgressRing.IsActive = false;
Dimmer.Visibility = Visibility.Collapsed; Dimmer.Visibility = Visibility.Collapsed;
} }
/// <summary> /// <summary>
@ -108,9 +109,16 @@ namespace IntelligentLabsTest
/// <param name="imageClasses"></param> /// <param name="imageClasses"></param>
/// <param name="listOfObjects"></param> /// <param name="listOfObjects"></param>
/// <returns></returns> /// <returns></returns>
private void UpdateTextBox(List<ClassificationResult> imageClasses, List<DetectionResult> listOfObjects) private void UpdateTextBox(List<ClassificationResult> imageClasses)
{ {
ResultsBlock.Text = ""; ResultsBlock.Text = "";
if(imageClasses.Count == 0)
{
ResultsBlock.Text = "No results";
return;
}
for (int i = 0; i < imageClasses.Count; ++i) for (int i = 0; i < imageClasses.Count; ++i)
{ {
if (i == 0) if (i == 0)
@ -122,7 +130,6 @@ namespace IntelligentLabsTest
} }
DrawBoxes(listOfObjects);
} }
/// <summary> /// <summary>