Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

38
LINES

< > BotCompany Repo | #1019536 // Make Best Face Finder By Pictures [OK, without no-face]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (10484L/75K).

!7

replace Finder with F1<RGBImage, Rect>.

sbool withNoFace = false;

p-exp {
  int w = 32;
  int limit = 95; // search for smallest finder with at least 95% accuracy
  
  File dir = ai_faceFinderDir();
  if (withNoFace) dir = newFile(dir, "with-no-face");
  
  L<RGBImageAndRect> marked = markedFaces_scaledToWidth(w, +withNoFace);
  FaceFinderByPictures1 finder = new(w, nonNulls(rgbImageAndRects_getClip(marked)));
  saveTextFileWithBackupVerbose(newFile(dir, "full-finder.struct"), struct(finder));
  new Best<Finder> best;
  video_scoreRect_step(best, marked, finder);
  //showImage(mergeRGBImagesAndRects(callFaceFinder(finder, rgbImageAndRects_images(marked))));
  
  new Best<Finder> best3;
  
  while (nempty(finder.pictures) && best.score() >= limit) {
    // Make finder smaller by removing pictures
    new Best<Finder> best2;
    for (int i = 0; i < l(finder.pictures); i++) {
      FaceFinderByPictures1 newFinder = shallowClone(finder);
      newFinder.pictures = listWithoutIndex(newFinder.pictures, i);
      //print("Took out image " + (i+1) + "/" + l(finder.pictures));
      video_scoreRect_step(best2, marked, newFinder, print := false);
      copyBestIfAtLeast(best2, best3, limit);
    }
    finder = (FaceFinderByPictures1) best2!;
    print("Got new finder with score " + best2.score() + ": " + finder);
  }
  
  saveTextFileWithBackupVerbose(newFile(dir, "smallest-finder-over-" + limit + ".struct"), struct(best3!));
}

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: 345 / 1168
Version history: 20 change(s)
Referenced in: #1019551 - Make Eyebrow Finder [OK, just uses all pictures and a certain width]
#1023100 - Make Face Finder [from pictures in Marked Faces directory]
#1023110 - Make Face Detector [including face/no face, OK, but result not very good yet]