Download Jar. Libraryless. Click here for Pure Java version (10484L/75K).
1 | !7 |
2 | |
3 | replace Finder with F1<RGBImage, Rect>. |
4 | |
5 | sbool withNoFace = false; |
6 | |
7 | p-exp { |
8 | int w = 32; |
9 | int limit = 95; // search for smallest finder with at least 95% accuracy |
10 | |
11 | File dir = ai_faceFinderDir(); |
12 | if (withNoFace) dir = newFile(dir, "with-no-face"); |
13 | |
14 | L<RGBImageAndRect> marked = markedFaces_scaledToWidth(w, +withNoFace); |
15 | FaceFinderByPictures1 finder = new(w, nonNulls(rgbImageAndRects_getClip(marked))); |
16 | saveTextFileWithBackupVerbose(newFile(dir, "full-finder.struct"), struct(finder)); |
17 | new Best<Finder> best; |
18 | video_scoreRect_step(best, marked, finder); |
19 | //showImage(mergeRGBImagesAndRects(callFaceFinder(finder, rgbImageAndRects_images(marked)))); |
20 | |
21 | new Best<Finder> best3; |
22 | |
23 | while (nempty(finder.pictures) && best.score() >= limit) { |
24 | // Make finder smaller by removing pictures |
25 | new Best<Finder> best2; |
26 | for (int i = 0; i < l(finder.pictures); i++) { |
27 | FaceFinderByPictures1 newFinder = shallowClone(finder); |
28 | newFinder.pictures = listWithoutIndex(newFinder.pictures, i); |
29 | //print("Took out image " + (i+1) + "/" + l(finder.pictures)); |
30 | video_scoreRect_step(best2, marked, newFinder, print := false); |
31 | copyBestIfAtLeast(best2, best3, limit); |
32 | } |
33 | finder = (FaceFinderByPictures1) best2!; |
34 | print("Got new finder with score " + best2.score() + ": " + finder); |
35 | } |
36 | |
37 | saveTextFileWithBackupVerbose(newFile(dir, "smallest-finder-over-" + limit + ".struct"), struct(best3!)); |
38 | } |
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019536 |
Snippet name: | Make Best Face Finder By Pictures [OK, without no-face] |
Eternal ID of this version: | #1019536/21 |
Text MD5: | e5290ff4a4ecfe3f46842fd93305a7b4 |
Transpilation MD5: | f44dbb4b325186af2d8b9a0536d9d718 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-05-05 20:21:57 |
Source code size: | 1484 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 330 / 1126 |
Version history: | 20 change(s) |
Referenced in: | [show references] |