Skip to content

en_TrainingCauseOfDeath

eli edited this page Jan 11, 2016 · 7 revisions

Training Cause of Death

  • We don't have good training tool yet. IkaLog.py will auto-generate if it can't load an existing model.
  • You'll need sorted samples in $IKALOG_BASE_DIRECTORY/training/deadly_weapons/$IKALOG_LANG/

Create a symlink to samples directory

It does work on MacOS X and Linux.

dhcp44-82:IkaLog hasegaw$ mkdir  -p training/deadly_weapons
dhcp44-82:IkaLog hasegaw$ ln -s ~/Dropbox/project_IkaLog/training/deadly_weapons/en_NA training/deadly_weapons/
dhcp44-82:IkaLog hasegaw$ ls -l training/deadly_weapons/en_NA/
total 48
-rw-r--r--@ 1 hasegaw  staff  1475 Jan  9 21:10 herocharger_replica.1.png
-rw-r--r--@ 1 hasegaw  staff  1473 Jan  9 21:10 herocharger_replica.2.png
-rw-r--r--@ 1 hasegaw  staff  1462 Jan  9 21:10 herocharger_replica.3.png
-rw-r--r--@ 1 hasegaw  staff  1402 Jan  9 21:10 screwslosher.1.png
-rw-r--r--@ 1 hasegaw  staff  1418 Jan  9 21:10 screwslosher.2.png
-rw-r--r--@ 1 hasegaw  staff  1413 Jan  9 21:10 screwslosher.3.png

Rebuilding the data from samples

dhcp44-82:IkaLog hasegaw$ rm data/deadly_weapons.en_NA.model

dhcp44-82:IkaLog hasegaw$ export IKALOG_LANG=en_NA
dhcp44-82:IkaLog hasegaw$ python3 IkaLog.py

<ikalog.utils.icon_recoginizer.weapon.WeaponRecoginizer object at 0x106779eb8>: KNN Trained (5395 samples)
(snip)
Building data/deadly_weapons.en_NA.model from training/deadly_weapons/en_NA
training/deadly_weapons/en_NA/herocharger_replica.1.png
training/deadly_weapons/en_NA/herocharger_replica.2.png
training/deadly_weapons/en_NA/herocharger_replica.3.png
training/deadly_weapons/en_NA/screwslosher.1.png
training/deadly_weapons/en_NA/screwslosher.2.png
training/deadly_weapons/en_NA/screwslosher.3.png
(etc.)
Writing data/deadly_weapons.en_NA.model
<ikalog.utils.matcher.IkaMatcher object at 0x10b6b40b8>: mask result_udemae.png: using ja version
<ikalog.utils.icon_recoginizer.gearpower.GearPowerRecoginizer object at 0x10b6b40f0>: KNN Trained (1010 samples)
^CIkaLog: got signal 2
bye!
dhcp44-82:IkaLog hasegaw$ ls -l data/deadly_weapons.en_NA.model
-rwx------  1 hasegaw  staff  10216 Jan  9  2016 data/deadly_weapons.en_NA.model

Check the results

dhcp44-82:IkaLog hasegaw$ export IKALOG_LANG=en_NA
dhcp44-82:IkaLog hasegaw$ python3 tools/sort_deadly_weapons.py ~/work/IkaLog_github8/training/deadly_weapons/en_NA/
<h3>52gal (12)</h1>
<!-- 52gal 0 --><img src=/Users/hasegaw/work/IkaLog_github8/training/deadly_weapons/ja/52gal.1.png>
<!-- 52gal 0 --><img src=/Users/hasegaw/work/IkaLog_github8/training/deadly_weapons/ja/52gal.10.png>
(..snip..)
<h3>52gal_deco (6)</h1>
<!-- 52gal_deco 0 --><img src=/Users/hasegaw/work/IkaLog_github8/training/deadly_weapons/ja/52gal_deco.1.png>
<!-- 52gal_deco 0 --><img src=/Users/hasegaw/work/IkaLog_github8/training/deadly_weapons/ja/52gal_deco.2.png>
(..snip..)
<h3>96gal (6)</h1>
<!-- 96gal 0 --><img src=/Users/hasegaw/work/IkaLog_github8/training/deadly_weapons/ja/96gal.1.png>
<!-- 96gal 0 --><img src=/Users/hasegaw/work/IkaLog_github8/training/deadly_weapons/ja/96gal.2.png>
(..snip..)

The output is in HTML format. You can review the result, like as:

dhcp44-82:IkaLog hasegaw$ export IKALOG_LANG=en_NA
dhcp44-82:IkaLog hasegaw$ python3 tools/sort_deadly_weapons.py ~/work/IkaLog_github8/training/deadly_weapons/en_NA/ > test_result.html
dhcp44-82:IkaLog hasegaw$ open test_result.html

Adding more samples

  • You'll see samples in wrong groups. Add A FEW of the samples to training data, and retry the process. The recognition is performed with KNN (K Nearest-Neighor), so the other wrong samples will move to the correct group eventually.
  • Today the parameter K is hardcoded to 3, it means the data must have at least 3 samples per each group.
  • Too many samples would make IkaLog.py slower in runtime.
  • You can stop training at around 70% accuracy. IkaLog will analyze many frames per a death, and will pick up the best one. e.g. You're killed with .52 Gal, and IkaLog got 100 "cause of death" frames. Number of frames, recognized as .52 Gal, has to be more than other groups, but not has to be 100%.