item_statistics_en - LmeSzinc/AzurLaneAutoScript GitHub Wiki
This document will show how to use dev_tools/item_statistics.py
In alas GUI,
-
set
enable_drop_screenshot
toyes
, if enabled, alas will add a 1s sleep before screenshot, to avoid capture the flash. There's a flash light when item shows up. -
set
drop_screenshot_folder
to be the folder you want to save. It is recommended to save it in SSD. -
Run Alas few hours or few days, and you will get a folder structure like:
(Screenshots are named after millisecond timestamp.)
<your_folder>
campaign_7_2
get_items
158323xxxxxxx.png
158323xxxxxxx.png
158323xxxxxxx.png
get_mission
get_ship
mystery
status
campaign_10_4_HARD
get_items
get_mission
get_ship
status
d3
get_items
get_mission
get_ship
status
-
Prepare another virtual environment, accoring to
requirements.txt
. But use the GPU version ofmxnet
.I am using GTX1080Ti, and I installed
mxnet-cu101==1.6.0
,CUDA10.1
,cuDNN
. Googlemxnet gpu install
, and see how to do in details. You may intall other version of CUDA, and mxnet for that CUDA, because you are using another graphic card. -
Goto module/ocr/al_ocr.py line 21, replace
context='cpu',
to be:
context='gpu',
Now cnocr will run on GPU.
You can skip this procedure anyway, and use the same environment as alas, but the OCR will run really slow.
Before any actual statistics, you need to extract templates first.
- Change your server in line 8:
server.server = 'cn' # Edit your server here.
- Set your
FOLDER
andCSV_FILE
at the bottom of the file.
"""
Args:
FOLDER: Alas drop screenshot folder.
Examples: '<your_drop_screenshot_folder>/campaign_7_2'
CSV_FILE: Csv file to save.
Examples: 'c72.csv'
"""
FOLDER = ''
CSV_FILE = ''
drop = DropStatistics(FOLDER)
- Uncomment the this and run.
# drop.extract_template()
You will get some new templates named in number under folder item_template
. Here's an example log:
1%| | 107/12668 [00:05<10:24, 20.10it/s]2020-06-03 10:39:42.609 | INFO | New item template: 50
1%| | 158/12668 [00:07<10:42, 19.47it/s]2020-06-03 10:39:45.098 | INFO | New item template: 51
2%|โ | 207/12668 [00:10<10:33, 19.66it/s]2020-06-03 10:39:47.772 | INFO | New item template: 52
2%|โ | 215/12668 [00:10<11:20, 18.29it/s]2020-06-03 10:39:48.304 | INFO | New item template: 53
100%|โโโโโโโโโโ| 12668/12668 [10:33<00:00, 19.99it/s]
-
Rename new templates with Camel-Case, such as
PlateGeneralT3
. Suffix in name will be ignore.For example,
Javelin
andJavelin_2
are different templates, but have same output name 'Javelin'.
Why extract templates before every stats, why not provide ready-made templates
- There are too many items in game, can't collect them all.
- If it find new templates during actual run, may give unexpected result.
- If some of your accounts used All-Skin, ship icons will be different.
- Too many templates will make it slow.
- Comment the code in first run.
drop.extract_template()
- uncomment this, and run.
import csv
with open(CSV_FILE, 'a', newline='') as csv_file:
writer = csv.writer(csv_file)
for d in drop.generate_data():
writer.writerows(d)
Here's an example log:
2020-06-03 12:23:55.355 | INFO | [ENEMY_GENRE 0.007s] ไธญๅไพฆๆฅ่ฐ้
2020-06-03 12:23:55.363 | INFO | [Amount_ocr 0.009s] [1, 1, 22]
100%|โโโโโโโโโโ| 14916/14919 [20:32<00:00, 13.20it/s]2020-06-03 12:23:55.442 | INFO | [ENEMY_GENRE 0.007s] ๅคงๅ่ช็ฉบ่ฐ้
2020-06-03 12:23:55.455 | INFO | [Amount_ocr 0.013s] [1, 1, 1, 17]
2020-06-03 12:23:55.539 | INFO | [ENEMY_GENRE 0.007s] ๆๆนๆ่ฐ
2020-06-03 12:23:55.549 | INFO | [Amount_ocr 0.010s] [1, 2, 1, 63]
100%|โโโโโโโโโโ| 14918/14919 [20:33<00:00, 12.35it/s]2020-06-03 12:23:55.623 | INFO | [ENEMY_GENRE 0.007s] ็ฒพ่ฑ่ฐ้
2020-06-03 12:23:55.633 | INFO | [Amount_ocr 0.010s] [1, 1, 1, 17]
100%|โโโโโโโโโโ| 14919/14919 [20:33<00:00, 12.10it/s]
Now you have a csv file, formated to be:
<get_item_timestamp>, <battle_status_timestamp>, <enemy_name>, <item_name>, <item_amount>
like this:
1590271317900,1590271315841,ไธญๅไธปๅ่ฐ้,ไธป็ฎ้จไปถT3,1
1590271317900,1590271315841,ไธญๅไธปๅ่ฐ้,็ฉ่ต,23
1590271359374,1590271357251,ๅฐๅไพฆๆฅ่ฐ้,้็จ้จไปถT1,1
1590271359374,1590271357251,ๅฐๅไพฆๆฅ่ฐ้,้ฑผ้ท้จไปถT2,1
1590271359374,1590271357251,ๅฐๅไพฆๆฅ่ฐ้,็ฉ่ต,13
1590271415308,1590271413207,ๆๆนๆ่ฐ,ๅฝๆ,1
1590271415308,1590271413207,ๆๆนๆ่ฐ,้็จ้จไปถT3,1
1590271415308,1590271413207,ๆๆนๆ่ฐ,็งๆ็ฎฑT1,1
1590271415308,1590271413207,ๆๆนๆ่ฐ,็ฉ่ต,42
1590271415308,1590271413207,ๆๆนๆ่ฐ,_ๆฏ่จ็ ๅ็ฉ่ต,1
1590271415308,1590271413207,ๆๆนๆ่ฐ,_้ธขๅฐพไนๅฐ,1
You can open it in Excel or load it into database.
These code is running on single thread, you can try adding multiprocess to speed up. I didn't do that because it's still acceptable (25it/s without ocr, 15it/s with ocr)