Uses 911K of libraries. Click here for Pure Java version (11729L/65K).
1 | !7 |
2 | |
3 | cmodule TrainChessRecognizer > DynSingleFunctionWithPrintLog { |
4 | transient new ChessOCR_SquareImagesCollector squareImagesCollector; |
5 | |
6 | start-thread { |
7 | //temp dm_tempDisableAllButtons(); |
8 | squareImagesCollector.loadImagesFromAGIBlue(); |
9 | } |
10 | |
11 | void doIt { |
12 | LPair<S, BufferedImage> images = squareImagesCollector.allImages(); |
13 | new ChessPieceRecognizer pieceRecognizer; |
14 | pieceRecognizer.load(); |
15 | new Best<Double> best; |
16 | for (double exp = -6; exp <= -2; exp += 0.02) { |
17 | double factor = pow(10, exp); |
18 | print("Factor: " + factor); |
19 | best.put(factor, scoreForFactor(images, pieceRecognizer, factor)); |
20 | } |
21 | print(best); |
22 | } |
23 | |
24 | double scoreForFactor(LPair<S, BufferedImage> images, ChessPieceRecognizer pieceRecognizer, double factor) { |
25 | try { |
26 | pieceRecognizer.magicCombineFactor = factor; |
27 | |
28 | new Scorer scorer; |
29 | for (unpair S piece, BufferedImage img : images) { |
30 | scorer.add(eqic(pairA(pieceRecognizer.recognize(img)), piece)); |
31 | } |
32 | |
33 | print(scorer); |
34 | ret scorer.score(); |
35 | } catch print e { |
36 | print("RECOGNIZER TOTAL FAIL"); |
37 | ret 0; |
38 | } |
39 | } |
40 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024760 |
Snippet name: | Optimize magicCombineFactor of Chess Piece Recognizer [OK] |
Eternal ID of this version: | #1024760/21 |
Text MD5: | 66e90be6750cc9c59621719ec64d0335 |
Transpilation MD5: | d53ca1db7c160334f97860fe9a005cdd |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-24 22:01:10 |
Source code size: | 1178 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 259 / 646 |
Version history: | 20 change(s) |
Referenced in: | [show references] |