Skip to content

Commit 78e24c3

Browse files
author
ChrisMaunder
committed
v2.5: Dynamic explorer UI, multi-TPU Coral, Jetson, Windows on Arm
1 parent 51984c1 commit 78e24c3

File tree

195 files changed

+8949
-3667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+8949
-3667
lines changed

.vscode/launch.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,10 @@
442442
},
443443
"name": "Object Detect Coral",
444444
"type": "python",
445-
"python": "${workspaceFolder}/src/modules/ObjectDetectionCoral/bin/linux/python39/venv/bin/python",
445+
"python": "${workspaceFolder}/src/modules/ObjectDetectionCoral/bin/windows/python39/venv/Scripts/python.exe",
446446
"request": "launch",
447447
"program": "objectdetection_coral_adapter.py",
448-
// "args": [ "--selftest" ],
448+
"args": [ "--selftest" ],
449449
"console": "integratedTerminal",
450450
"cwd": "${workspaceFolder}/src/modules/ObjectDetectionCoral",
451451
"justMyCode": false,
@@ -456,7 +456,7 @@
456456
"CPAI_MODULE_QUEUENAME": "objectdetection_queue"
457457
},
458458
"windows": {
459-
"python": "${workspaceFolder}/src/modules/ObjectDetectionCoral/bin/windows/python37/venv/Scripts/python.exe",
459+
"python": "${workspaceFolder}/src/modules/ObjectDetectionCoral/bin/windows/python39/venv/Scripts/python.exe",
460460
},
461461
"linux": {
462462
"python": "${workspaceFolder}/src/modules/ObjectDetectionCoral/bin/linux/python39/venv/bin/python",
@@ -565,7 +565,7 @@
565565
},
566566
"name": "Object Detect YOLOv5 3.1 Jetson",
567567
"type": "python",
568-
"python": "${workspaceFolder}/src/modules/ObjectDetectionYOLOv5-3.1/bin/linux/python36/venv/bin/python",
568+
"python": "${workspaceFolder}/src/modules/ObjectDetectionYOLOv5-3.1/bin/linux/python38/venv/bin/python",
569569
"request": "launch",
570570
"program": "detect_adapter.py",
571571
// "args": [ "--selftest" ],
@@ -736,7 +736,7 @@
736736
},
737737
"name": "Sound Classifier",
738738
"type": "python",
739-
"python": "${workspaceFolder}/src/modules/SoundClassifierTF/bin/linux/python39/venv/bin/python3.8",
739+
"python": "${workspaceFolder}/src/modules/SoundClassifierTF/bin/linux/python39/venv/bin/python3",
740740
"request": "launch",
741741
"program": "sound_classification_adapter.py",
742742
// "args": [ "--selftest" ],
@@ -746,16 +746,17 @@
746746
"env": {
747747
"DEBUG_IN_VSCODE": "True",
748748
"RUNNING_IN_VSCODE": "True",
749-
"CPAI_PORT": "32168"
749+
"CPAI_PORT": "32168",
750+
"MODELS_DIR": "${workspaceFolder}/src/modules/SoundClassifierTF/assets"
750751
},
751752
"windows": {
752753
"python": "${workspaceFolder}/src/modules/SoundClassifierTF/bin/windows/python39/venv/Scripts/python",
753754
},
754755
"linux": {
755-
"python": "${workspaceFolder}/src/modules/SoundClassifierTF/bin/linux/python39/venv/bin/python3.8",
756+
"python": "${workspaceFolder}/src/modules/SoundClassifierTF/bin/linux/python38/venv/bin/python3",
756757
},
757758
"osx": {
758-
"python": "${workspaceFolder}/src/modules/SoundClassifierTF/bin/macos/python39/venv/bin/python",
759+
"python": "${workspaceFolder}/src/modules/SoundClassifierTF/bin/macos/python38/venv/bin/python",
759760
}
760761
},
761762

@@ -833,7 +834,7 @@
833834
"RUNNING_IN_VSCODE": "True",
834835
"CPAI_PORT": "32168",
835836

836-
"NLTK_DATA": "/app/modules/TextSummary/nltk_data"
837+
"NLTK_DATA": "${workspaceFolder}/src/modules/TextSummary/nltk_data"
837838
},
838839
"windows": {
839840
"python": "${workspaceFolder}/src/modules/TextSummary/bin/windows/python37/venv/Scripts/python.exe"
@@ -868,16 +869,17 @@
868869
"YOLOv5_AUTOINSTALL": "false",
869870
"YOLOv5_VERBOSE": "false",
870871

871-
"CPAI_MODULE_REQUIRED_MB": "7000",
872+
"CPAI_MODULE_REQUIRED_MB": "1000",
872873

873874
"YOLO_DATASETS_DIRNAME": "datasets",
874-
"YOLO_TRAINING_DIRNAME": "training",
875+
"YOLO_TRAINING_DIRNAME": "train", // compatible with tutorials and default
875876
"YOLO_WEIGHTS_DIRNAME": "weights",
876877
"YOLO_MODELS_DIRNAME": "assets",
877-
"YOLO_DATASET_ZOO_DIRNAME": "zoo"
878+
"YOLO_DATASET_ZOO_DIRNAME": "zoo",
879+
"FIFTYONE_DATABASE_DIRNAME": "fiftyone"
878880
},
879881
"windows": {
880-
"python": "${workspaceFolder}/src/modules/TrainingObjectDetectionYOLOv5/bin/windows/python39/venv/Scripts/python.exe"
882+
"python": "${workspaceFolder}/src/modules/TrainingObjectDetectionYOLOv5/bin/windows/python37/venv/Scripts/python.exe"
881883
},
882884
"linux": {
883885
"python": "${workspaceFolder}/src/modules/TrainingObjectDetectionYOLOv5/bin/linux/python38/venv/bin/python",

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"csharp.debug.logging.moduleLoad": false,
3+
// "dotnet.server.trace":"Trace",
4+
25
"cSpell.words": [
36
"alpr",
47
"APPDIR",
@@ -24,6 +27,7 @@
2427
"deskew",
2528
"Dgram",
2629
"downloadables",
30+
"downsampling",
2731
"dtype",
2832
"edgetpu",
2933
"endtimer",
@@ -46,6 +50,8 @@
4650
"intelligencelayer",
4751
"Jetson",
4852
"keypair",
53+
"labelledby",
54+
"Lanczos",
4955
"licence",
5056
"logvals",
5157
"memused",
@@ -62,6 +68,7 @@
6268
"orangepi",
6369
"otsu",
6470
"paddleocr",
71+
"peasy",
6572
"platenumber",
6673
"pluralise",
6774
"postinst",
@@ -103,6 +110,7 @@
103110
"wavfile",
104111
"wslconfig",
105112
"wwwroot",
113+
"xlink",
106114
"YOLO",
107115
"yolov5"
108116
]

CodeProject.AI.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A8B76501-496A-4011-9C37-8308A1EBDFA7}"
77
ProjectSection(SolutionItems) = preProject
88
src\create_packages.bat = src\create_packages.bat
9+
src\create_packages.sh = src\create_packages.sh
910
src\setup.bat = src\setup.bat
1011
src\setup.sh = src\setup.sh
1112
EndProjectSection

THIRD-PARTY-NOTICES.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -564,24 +564,24 @@ for which you have or can give appropriate copyright permission.
564564
add to a covered work, you may (if authorized by the copyright holders of
565565
that material) supplement the terms of this License with terms:
566566

567-
a) Disclaiming warranty or limiting liability differently from the
567+
a) Disclaiming warranty or limiting liability differently from the
568568
terms of sections 15 and 16 of this License; or
569569

570-
b) Requiring preservation of specified reasonable legal notices or
570+
b) Requiring preservation of specified reasonable legal notices or
571571
author attributions in that material or in the Appropriate Legal
572572
Notices displayed by works containing it; or
573573

574-
c) Prohibiting misrepresentation of the origin of that material, or
574+
c) Prohibiting misrepresentation of the origin of that material, or
575575
requiring that modified versions of such material be marked in
576576
reasonable ways as different from the original version; or
577577

578-
d) Limiting the use for publicity purposes of names of licensors or
578+
d) Limiting the use for publicity purposes of names of licensors or
579579
authors of the material; or
580580

581-
e) Declining to grant rights under trademark law for use of some
581+
e) Declining to grant rights under trademark law for use of some
582582
trade names, trademarks, or service marks; or
583583

584-
f) Requiring indemnification of licensors and authors of that
584+
f) Requiring indemnification of licensors and authors of that
585585
material by anyone who conveys the material (or modified versions of
586586
it) with contractual assumptions of liability to the recipient, for
587587
any liability that these contractual assumptions directly impose on

demos/TestData/Sounds/klaxon.wav

340 KB
Binary file not shown.

demos/dotNet/CodeProject.AI.Explorer/Form1.cs

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ private void ImageSelect_Click(object sender, EventArgs e)
7575
bool enable = !string.IsNullOrWhiteSpace(_imageFileName);
7676
DetectFaceBtn.Enabled = DetectSceneBtn.Enabled = DetectObjectsBtn.Enabled = enable;
7777
}
78+
7879
private void ImageFileName_TextChanged(object sender, EventArgs e)
7980
{
8081
_imageFileName = ImageFileName.Text;
8182

8283
bool enable = !string.IsNullOrWhiteSpace(_imageFileName);
8384
DetectFaceBtn.Enabled = DetectSceneBtn.Enabled = DetectObjectsBtn.Enabled = enable;
8485
}
86+
8587
private void FaceImage1Select_Click(object sender, EventArgs e)
8688
{
8789
CompareFacesBtn.Enabled = false;
@@ -176,16 +178,16 @@ private async void DetectFaceBtn_Click(object sender, EventArgs e)
176178

177179
List<string> lines = new();
178180

179-
if (detectedFaces.predictions is not null)
181+
if (detectedFaces.Predictions is not null)
180182
{
181-
foreach (var (face, index) in detectedFaces.predictions
183+
foreach (var (face, index) in detectedFaces.Predictions
182184
.Select((face, index) => (face, index)))
183185
{
184-
lines.Add($"{index}: Confidence: {Math.Round(face.confidence, 3)}");
186+
lines.Add($"{index}: Confidence: {Math.Round(face.Confidence*100.0, 2)}");
185187

186-
var rect = Rectangle.FromLTRB(face.x_min, face.y_min, face.x_max, face.y_max);
188+
var rect = Rectangle.FromLTRB(face.X_min, face.Y_min, face.X_max, face.Y_max);
187189
canvas.DrawRectangle(_boundingBoxPen, rect);
188-
canvas.DrawString(index.ToString(), _textFont, _textBrush, face.x_min, face.y_min);
190+
canvas.DrawString(index.ToString(), _textFont, _textBrush, face.X_min, face.Y_min);
189191
}
190192

191193
detectionResult.Lines = lines.ToArray();
@@ -219,7 +221,7 @@ private async void CompareFacesBtn_Click(object sender, EventArgs e)
219221
var result = await _serverClient.MatchFaces(_faceImageFileName1, _faceImageFileName2);
220222
if (result is MatchFacesResponse matchedFaces)
221223
{
222-
detectionResult.Text = $"Similarity: {Math.Round(matchedFaces.similarity, 4)}";
224+
detectionResult.Text = $"Similarity: {Math.Round(matchedFaces.Similarity, 4)}";
223225
SetStatus("Face Comparison complete");
224226
}
225227
else
@@ -245,7 +247,7 @@ private async void DetectSceneBtn_Click(object sender, EventArgs e)
245247
var image = GetImage(_imageFileName);
246248
pictureBox1.Image = image;
247249

248-
detectionResult.Text = $"Confidence: {Math.Round(detectedScene.confidence, 3)} Label: {detectedScene.label}";
250+
detectionResult.Text = $"Confidence: {Math.Round(detectedScene.Confidence*100.0, 2)} Label: {detectedScene.Label}";
249251
SetStatus("Scene Detection complete");
250252
}
251253
else
@@ -275,14 +277,14 @@ private async void DetectObjectsBtn_Click(object sender, EventArgs e)
275277
try
276278
{
277279
lines.Add(stopwatch.Elapsed.ToString());
278-
if (detectedObjects.predictions is not null)
279-
foreach (var (detectedObj, index) in detectedObjects.predictions
280+
if (detectedObjects.Predictions is not null)
281+
foreach (var (detectedObj, index) in detectedObjects.Predictions
280282
.Select((detected, index) => (detected, index)))
281283
{
282-
lines.Add($"{index}: Conf: {Math.Round(detectedObj.confidence, 3)} {detectedObj.label}");
284+
lines.Add($"{index}: Conf: {Math.Round(detectedObj.Confidence*100.0, 2)} {detectedObj.Label}");
283285

284-
var rect = Rectangle.FromLTRB(detectedObj.x_min, detectedObj.y_min,
285-
detectedObj.x_max, detectedObj.y_max);
286+
var rect = Rectangle.FromLTRB(detectedObj.X_min, detectedObj.Y_min,
287+
detectedObj.X_max, detectedObj.Y_max);
286288
}
287289

288290
detectionResult.Lines = lines.ToArray();
@@ -296,16 +298,16 @@ private async void DetectObjectsBtn_Click(object sender, EventArgs e)
296298

297299
Graphics canvas = Graphics.FromImage(image);
298300

299-
if (detectedObjects.predictions is not null)
301+
if (detectedObjects.Predictions is not null)
300302
{
301-
foreach (var (detectedObj, index) in detectedObjects.predictions
303+
foreach (var (detectedObj, index) in detectedObjects.Predictions
302304
.Select((detected, index) => (detected, index)))
303305
{
304-
var rect = Rectangle.FromLTRB(detectedObj.x_min, detectedObj.y_min,
305-
detectedObj.x_max, detectedObj.y_max);
306+
var rect = Rectangle.FromLTRB(detectedObj.X_min, detectedObj.Y_min,
307+
detectedObj.X_max, detectedObj.Y_max);
306308
canvas.DrawRectangle(_boundingBoxPen, rect);
307-
canvas.DrawString($"{index}:{detectedObj.label}", _textFont, _textBrush,
308-
detectedObj.x_min, detectedObj.y_min);
309+
canvas.DrawString($"{index}:{detectedObj.Label}", _textFont, _textBrush,
310+
detectedObj.X_min, detectedObj.Y_min);
309311
}
310312
}
311313

@@ -314,7 +316,7 @@ private async void DetectObjectsBtn_Click(object sender, EventArgs e)
314316
}
315317
catch (Exception ex)
316318
{
317-
ProcessError(new ErrorResponse (ex.Message));
319+
ProcessError(new ServerErrorResponse (ex.Message));
318320
detectionResult.Lines = lines.ToArray();
319321
}
320322
}
@@ -328,6 +330,7 @@ private void OnUserIdTextboxChanged(object sender, EventArgs e)
328330
{
329331
DeleteFaceBtn.Enabled = !string.IsNullOrWhiteSpace(UserIdTextbox.Text);
330332
}
333+
331334
private async void RegisterFaceBtn_Click(object sender, EventArgs e)
332335
{
333336
ClearResults();
@@ -376,18 +379,18 @@ private async void RecognizeFaceBtn_Click(object sender, EventArgs e)
376379
Graphics canvas = Graphics.FromImage(image);
377380

378381
List<string> lines = new();
379-
if (recognizeFace.predictions is not null)
382+
if (recognizeFace.Predictions is not null)
380383
{
381-
var predictionMap = recognizeFace.predictions
384+
var predictionMap = recognizeFace.Predictions
382385
.Select((prediction, Index) => (prediction, Index));
383386
foreach (var (prediction, index) in predictionMap)
384387
{
385-
lines.Add($"{index}: Conf: {Math.Round(prediction.confidence, 3)} {prediction.userid}");
386-
var rect = Rectangle.FromLTRB(prediction.x_min, prediction.y_min,
387-
prediction.x_max, prediction.y_max);
388+
lines.Add($"{index}: Conf: {Math.Round(prediction.Confidence*100.0, 2)} {prediction.Userid}");
389+
var rect = Rectangle.FromLTRB(prediction.X_min, prediction.Y_min,
390+
prediction.X_max, prediction.Y_max);
388391
canvas.DrawRectangle(_boundingBoxPen, rect);
389-
canvas.DrawString($"{index}:{prediction.userid}", _textFont, _textBrush,
390-
prediction.x_min, prediction.y_min);
392+
canvas.DrawString($"{index}:{prediction.Userid}", _textFont, _textBrush,
393+
prediction.X_min, prediction.Y_min);
391394
}
392395

393396
detectionResult.Lines = lines.ToArray();
@@ -398,7 +401,7 @@ private async void RecognizeFaceBtn_Click(object sender, EventArgs e)
398401
}
399402
catch (Exception ex)
400403
{
401-
ProcessError(new ErrorResponse($"{filename} caused: {ex.Message}"));
404+
ProcessError(new ServerErrorResponse($"{filename} caused: {ex.Message}"));
402405
}
403406
}
404407
else
@@ -410,15 +413,15 @@ private async void ListFacesBtn_Click(object sender, EventArgs e)
410413
ClearResults();
411414
SetStatus("Listing known faces");
412415

413-
var result = await _serverClient.ListRegisteredFaces() as ModuleResponseBase;
416+
var result = await _serverClient.ListRegisteredFaces();
414417
if (result is ListRegisteredFacesResponse registeredFaces)
415418
{
416419
if (result?.Success ?? false)
417420
{
418421
List<string> lines = new();
419-
if (registeredFaces.faces != null)
422+
if (registeredFaces.Faces != null)
420423
{
421-
var faceMap = registeredFaces.faces.Select((face, Index) => (face, Index));
424+
var faceMap = registeredFaces.Faces.Select((face, Index) => (face, Index));
422425
foreach (var (face, index) in faceMap)
423426
{
424427
lines.Add($"{index}: {face}");
@@ -455,7 +458,7 @@ private async void DeleteFaceBtn_Click(object sender, EventArgs e)
455458
ClearResults();
456459
SetStatus("Deleting registered face");
457460

458-
var result = await _serverClient.DeleteRegisteredFace(UserIdTextbox.Text) as ModuleResponseBase;
461+
var result = await _serverClient.DeleteRegisteredFace(UserIdTextbox.Text);
459462
if (result?.Success ?? false)
460463
SetStatus("Completed Face deletion");
461464
else
@@ -545,7 +548,7 @@ private void ProcessError(ServerResponse? result)
545548
pictureBox1.Image = null;
546549
detectionResult.Text = string.Empty;
547550

548-
if (result is ErrorResponse response)
551+
if (result is ServerErrorResponse response)
549552
ShowError($"Error: {response.Code} - {response.Error ?? "No Error Message"}");
550553
else if (result is null)
551554
ShowError("Null result");

0 commit comments

Comments
 (0)