Skip to content

en_Installation_CLI

Takeshi HASEGAWA edited this page May 3, 2016 · 9 revisions

IkaLog CLI installation

NOTE: Before this procedure, install Python3 in your environment. See en_Home for applicable procedures.

Clone the IkaLog repository from GitHub

dhcp44-82:work hasegaw$ git clone [email protected]:hasegaw/IkaLog.git
# If you prefer HTTPS rather than SSH, "git clone https://github.com/hasegaw/IkaLog.git"

Cloning into 'IkaLog'...
remote: Counting objects: 2494, done.
remote: Compressing objects: 100% (101/101), done.
remote: Total 2494 (delta 54), reused 0 (delta 0), pack-reused 2393
Receiving objects: 100% (2494/2494), 3.08 MiB | 1.46 MiB/s, done.
Resolving deltas: 100% (1686/1686), done.
Checking connectivity... done.

dhcp44-82:work hasegaw$ cd IkaLog

dhcp44-82:IkaLog hasegaw$ ls -l
total 96
-rw-r--r--   1 hasegaw  staff   2948 Oct 22 14:27 INSTALL
-rw-r--r--   1 hasegaw  staff   4183 Oct 22 14:27 IkaConfig.py.sample
-rw-r--r--   1 hasegaw  staff   1117 Oct 22 14:27 IkaLog.py
-rw-r--r--   1 hasegaw  staff   8913 Oct 22 14:27 IkaUI.py
-rw-r--r--   1 hasegaw  staff  10174 Oct 22 14:27 LICENSE
-rw-r--r--   1 hasegaw  staff    424 Oct 22 14:27 README.md
drwxr-xr-x   8 hasegaw  staff    272 Oct 22 14:27 data
drwxr-xr-x   3 hasegaw  staff    102 Oct 22 14:27 debug_videos
drwxr-xr-x   7 hasegaw  staff    238 Oct 22 14:27 doc
drwxr-xr-x  11 hasegaw  staff    374 Oct 22 14:27 ikalog
drwxr-xr-x   4 hasegaw  staff    136 Oct 22 14:27 lib
drwxr-xr-x  33 hasegaw  staff   1122 Oct 22 14:27 masks
drwxr-xr-x   3 hasegaw  staff    102 Oct 22 14:27 screenshots
-rw-r--r--   1 hasegaw  staff   1893 Oct 22 14:27 setup.py
drwxr-xr-x   8 hasegaw  staff    272 Oct 22 14:27 test
drwxr-xr-x  10 hasegaw  staff    340 Oct 22 14:27 tools

Make a config file (See en_IkaConfig for details)

dhcp44-82:IkaLog hasegaw$ cp IkaConfig.py.sample IkaConfig.py
dhcp44-82:IkaLog hasegaw$ vim IkaConfig.py

Configuring PYTHONPATH

The core part is IkaLog is implemented as ikalog Python module. IkaLog, and IkaUI should find the modules but you need to specify PYTHONPATH as below, so that python find your ikalog module in current directory("."). This allows to import ikalog.* namespaces in your Python commandline.

Windows:

> SET PYTHONPATH=.

MacOS X (bash):

dhcp44-82:IkaLog_github hasegaw$ export PYTHONPATH=.

Process a sample video in dropbox

If you have IkaConfig.py above, you can process a movie from Dropbox:

dhcp44-82:IkaLog_github hasegaw$ export PYTHONPATH=.
dhcp44-82:IkaLog_github hasegaw$ python3 IkaLog.py --input_file https://dl.dropboxusercontent.com/u/14421778/IkaLog/ikalog_sample.mp4

Output Example

dhcp44-81:IkaLog_github9 hasegaw$ python3 IkaLog.py --input_file /Users/hasegaw/Dropbox/Public/IkaLog/ikalog_sample.mp4
IkaLog Primary CLI Language: en (set LANG to override)
IkaLog Game Language: ja (set IKALOG_LANG to override)
<ikalog.utils.icon_recoginizer.weapon.WeaponRecoginizer object at 0x1109f5cc0>: KNN Trained (6967 samples)
<ikalog.utils.icon_recoginizer.gearpower.GearPowerRecoginizer object at 0x1109f5f60>: KNN Trained (1010 samples)
<ikalog.utils.icon_recoginizer.gearpower.GearPowerRecoginizer object at 0x1109f5f60>: KNN Trained (1010 samples)
<ikalog.inputs.filters.warp_model.WarpFilterModel object at 0x1162c77f0>: Loaded model data
  /Users/hasegaw/work/IkaLog_github9/data/webcam_calibration.ja.model (3010 keypoints)
<ikalog.outputs.websocket_server.WebSocketServer object at 0x1162c74e0>
helllo
[<ikalog.outputs.preview.Screen object at 0x1162bd278>, <ikalog.outputs.console.Console object at 0x1162c7710>, <ikalog.outputs.printjson.JSON object at 0x1162c76a0>, <ikalog.outputs.twitter.Twitter object at 0x1162c75f8>, <ikalog.outputs.debug.DebugLog object at 0x1162c7470>, <ikalog.outputs.websocket_server.WebSocketServer object at 0x1162c74e0>, <ikalog.outputs.preview_detected.PreviewDetected object at 0x1162c7860>, <ikalog.outputs.osx.say.Say object at 0x11d33ecf8>, <ikalog.inputs.opencv_file.CVFile object at 0x1162c75c0>]
<ikalog.outputs.websocket_server.WebSocketServer object at 0x1162c74e0>: Listen port 9090
<ikalog.outputs.websocket_server.WebSocketServer object at 0x1162c74e0>: Started server thread
<ikalog.scenes.game.inklings_tracker.InklingsTracker object at 0x1162b8c88>: switching to state _state_start
[event] 00:00 on_lobby_matched  Lobby_type: tag, team_members: 2
<ikalog.scenes.game.start.GameStart object at 0x11262ef98>: switching to state _state_tracking
<ikalog.scenes.game.inklings_tracker.InklingsTracker object at 0x1162b8c88>: switching to state _state_start
Game Start. Stage: Arowana Mall, Mode: Rainmaker
[event] 00:10 on_game_start
<ikalog.scenes.game.start.GameStart object at 0x11262ef98>: switching to state _state_default
<ikalog.scenes.game.inklings_tracker.InklingsTracker object at 0x1162b8c88>: switching to state _state_start
Go!
[event] 00:16 on_game_go_sign
<ikalog.scenes.game.inklings_tracker.InklingsTracker object at 0x1162b8c88>: switching to state _state_default
/usr/local/lib/python3.4/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice.
  warnings.warn("Mean of empty slice.", RuntimeWarning)
/usr/local/lib/python3.4/site-packages/numpy/core/_methods.py:71: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
[event] 00:16 on_game_inkling_state_update  [[True, True, True, True], [True, True, True, True]]
[event] 00:30 on_game_inkling_state_update  [[True, True, True, True], [False, True, True, True]]
[event] 00:31 on_game_inkling_state_update  [[True, True, True, True], [False, True, True, False]]
<ikalog.scenes.game.ranked_battle_events.GameRankedBattleEvents object at 0x1162b8198>: switching to state _state_pending
<ikalog.scenes.game.ranked_battle_events.GameRankedBattleEvents object at 0x1162b8198>: trigger an event on_game_rainmaker_we_got
We have the Rainmaker!
[event] 00:33 on_game_rainmaker_we_got
<ikalog.scenes.game.ranked_battle_events.GameRankedBattleEvents object at 0x1162b8198>: switching to state _state_triggered
<ikalog.scenes.game.ranked_battle_events.GameRankedBattleEvents object at 0x1162b8198>: switching to state _state_default
<ikalog.scenes.game.ranked_battle_events.GameRankedBattleEvents object at 0x1162b8198>: matched None
[event] 00:35 on_game_inkling_state_update  [[True, True, True, False], [False, True, True, False]]
[event] 00:35 on_game_inkling_state_update  [[True, True, True, True], [False, True, True, False]]
[event] 00:37 on_game_inkling_state_update  [[True, True, True, True], [False, False, True, False]]
[event] 00:39 on_game_inkling_state_update  [[True, True, True, True], [True, False, True, False]]
[event] 00:39 on_game_inkling_state_update  [[True, True, True, True], [True, False, True, True]]
<ikalog.scenes.game.special_weapon.GameSpecialWeapon object at 0x1162b4668>: switching to state _state_tracking
[event] 00:43 on_game_inkling_state_update  [[True, True, True, True], [True, False, False, True]]
Splatted an enemy!
[event] 00:43 on_game_killed
[event] 00:44 on_game_inkling_state_update  [[True, True, True, True], [False, False, True, True]]
[event] 00:44 on_game_inkling_state_update  [[True, True, True, True], [True, False, False, True]]
[event] 00:44 on_game_inkling_state_update  [[True, True, True, False], [False, True, True, False]]
<ikalog.scenes.game.special_weapon.GameSpecialWeapon object at 0x1162b4668>: switching to state _state_default
[event] 00:44 on_game_inkling_state_update  [[True, True, True, True], [True, False, False, True]]
[event] 00:45 on_game_inkling_state_update  [[True, True, True, True], [True, True, False, True]]
[event] 00:48 on_game_inkling_state_update  [[True, False, True, True], [True, True, False, True]]
[event] 00:48 on_game_inkling_state_update  [[True, False, True, True], [True, True, False, False]]
Game End.
[event] 00:53 on_game_finish
trigger event
[event] 00:59 on_result_judge  judge: win, knockout: True
<ikalog.scenes.result_detail.ResultDetail object at 0x1162b8f98>: switching to state _state_tracking
<ikalog.scenes.result_detail.ResultDetail object at 0x1162b8f98>: weapons recoginition started.
<ikalog.scenes.result_detail.ResultDetail object at 0x1162b8f98>: weapons recoginition done.
Results. Stage: Arowana Mall, Mode: Rainmaker, Result: won 1K/0D Weapon: dualsweeper_custom Rank in the team: 2 Rank: B
[event] 01:08 on_game_individual_result
<ikalog.scenes.game.inklings_tracker.InklingsTracker object at 0x1162b8c88>: switching to state _state_start
<ikalog.scenes.result_udemae.ResultUdemae object at 0x1162bd2b0>: switching to state _state_tracking
<ikalog.scenes.result_detail.ResultDetail object at 0x1162b8f98>: switching to state _state_default
<ikalog.scenes.result_gears.ResultGears object at 0x1162bd390>: switching to state _state_tracking
<ikalog.scenes.result_udemae.ResultUdemae object at 0x1162bd2b0>:  udemae change: b 24 -> b 36
[event] 01:16 on_result_udemae  {'udemae_str': 'b', 'udemae_exp': 24, 'udemae_exp_after': 36, 'udemae_str_after': 'b'}
<ikalog.scenes.result_udemae.ResultUdemae object at 0x1162bd2b0>: switching to state _state_default
[event] 01:24 on_result_gears
<ikalog.scenes.result_gears.ResultGears object at 0x1162bd390>: switching to state _state_default
Watchdog fired. Closing current session
Game Session end.
<ikalog.outputs.printjson.JSON object at 0x1162c76a0> (enabled = True)
<ikalog.outputs.twitter.Twitter object at 0x1162c75f8> (enabled = True)
Tweet: @_ikalog_ Just won Rainmaker at Arowana Mall (2016/03/29 00:55)  #IkaLogResult
[event] 01:25 on_game_session_end  death_reasons = {}
[event] 01:27 on_lobby_matching  Lobby_type: tag
0.216s <ikalog.scenes.game.timer_icon.GameTimerIcon object at 0x10c46e320>
6.756s <ikalog.scenes.game.start.GameStart object at 0x11262ef98>
0.006s <ikalog.scenes.game.go_sign.GameGoSign object at 0x1162b4358>
0.215s <ikalog.scenes.game.kill.GameKill object at 0x1162b4438>
0.054s <ikalog.scenes.game.dead.GameDead object at 0x1162b4518>
0.004s <ikalog.scenes.game.oob.GameOutOfBound object at 0x1162b4630>
0.074s <ikalog.scenes.game.finish.GameFinish object at 0x1162b4b70>
0.081s <ikalog.scenes.game.special_gauge.GameSpecialGauge object at 0x1162b4c50>
0.074s <ikalog.scenes.game.special_weapon.GameSpecialWeapon object at 0x1162b4668>
2.045s <ikalog.scenes.game.ranked_battle_events.GameRankedBattleEvents object at 0x1162b8198>
0.033s <ikalog.scenes.game.paint_score_tracker.PaintScoreTracker object at 0x1162b8b00>
0.123s <ikalog.scenes.game.objective_tracker.ObjectiveTracker object at 0x1162b46a0>
0.003s <ikalog.scenes.game.splatzone_tracker.SplatzoneTracker object at 0x1162b8ba8>
0.165s <ikalog.scenes.game.inklings_tracker.InklingsTracker object at 0x1162b8c88>
0.557s <ikalog.scenes.result_judge.ResultJudge object at 0x1162b8cc0>
0.812s <ikalog.scenes.result_detail.ResultDetail object at 0x1162b8f98>
0.171s <ikalog.scenes.result_udemae.ResultUdemae object at 0x1162bd2b0>
12.747s <ikalog.scenes.result_gears.ResultGears object at 0x1162bd390>
0.035s <ikalog.scenes.result_festa.ResultFesta object at 0x1162bd5c0>
0.259s <ikalog.scenes.lobby.Lobby object at 0x1162bd748>
0.114s <ikalog.scenes.downie.Downie object at 0x1162c7198>
0.388s <ikalog.scenes.blank.Blank object at 0x1162bd400>
bye!

If you can't play the movie, you may have issues in your OpenCV 3.x installation (e.g. missed --with-ffmpeg)