poe-archnemesis-scanner icon indicating copy to clipboard operation
poe-archnemesis-scanner copied to clipboard

Detect empty slots

Open Irfy opened this issue 3 years ago • 5 comments

I am consistently getting misses on a full inventory and use this one-liner to verify the number of detected slots:

python -c "while True: print(len(sum(eval(input()).values(),[])));"

I recommend adding a black box to the pictures to be explicitly detected as the most probable match for empty slots. When this is given, the tool can add up the number of detected slots to make sure all 64 slots were detected.

For now, I copy the final output of the scanning every time into the above snippet to make sure I hit the number of items I know are in the inventory. If I have misses I then typically reduce the confidence threshold until I hit everything I have. My sweet spot for confidence is 0.91.

Automatic confidence adjustment (="Calibration") can be considered an idea (loop, reducing the confidence threshold until all non-empty slots are detected, down to a predefined absolute minimum), but for starters, an indication like 3x Unknown in some warning-colored text would be perfect.

Irfy avatar Feb 17 '22 20:02 Irfy

Yes please. i've had to lower the confidence slightly before, as it was missing 1 or 2 parts some of the times. I lowered my confidence to 0.92, but still suspect that it missed some.

andr9528 avatar Feb 17 '22 20:02 andr9528

There now should be a information about the items that the tool was able to detect. Something like this:

...
row=6, column=8, item=Juggernaut, confidence=0.9771817326545715
row=7, column=1, item=Overcharged, confidence=0.9776066541671753
row=7, column=2 is empty
row=7, column=3, item=Berserker, confidence=0.9845896363258362
row=7, column=4, item=Juggernaut, confidence=0.9771813154220581
row=7, column=5, item=Hasted, confidence=0.978759229183197
row=7, column=6, item=Permafrost, confidence=0.976910412311554
row=7, column=7, item=Frostweaver, confidence=0.9772088527679443
row=7, column=8 is empty
row=8, column=1 is empty
...

Do you think that would be enough to help you?

4rtzel avatar Feb 18 '22 19:02 4rtzel

The coordinates are very helpful for debugging, but for the quick glance/overview, it would be even more helpful to have a final log output like "Found 60 recognized tokens, 3 empty slots and 1 unrecognized token" (or whatever wording you use for the "archnemesis things" instead of "token").

More can definitely be done, but let's defer that until we see if the tool works well enough for now. If misses are still reported, it may make sense to implement two more UI-related things on top of the above:

  1. Show empty slots as-if they are an archnemesis token of their own, showing them in some colored text (e.g. 3x Empty slot) right there with the rest of it, allowing them to be moused-over which would highlight the empty slots. This way the user can visually make sure they are, in fact, empty. This could be a checkbox in settings that is enabled or disabled.

  2. When a slot matches neither an archnemesis token, nor the empty slot image, that would indicate an unrecognized archnemesis token and the tool could force-select the highest confidence match it got even if it's below the threshold, and/or inform the user with a dialog that this happened and that the user should consider lowering the threshold to the lowest value detected for all slots. Right now, as far as I can tell, if no image matches with high-enough confidence, the tool silently skips that slot (?) -- this is bad, and this approach would fix that. This way, the threshold could be more liberally lowered by default too.

Irfy avatar Feb 19 '22 22:02 Irfy

I quickly added a message with the information about the number of items found in a new v0.2.2 version. The rest of the changes will have to wait until I stabilize the tool.

4rtzel avatar Feb 20 '22 12:02 4rtzel

On first run it consistently showed all slots empty, but after a restart of the tool it showed everything as expected. The message is sufficient for now. If this works well, no need for the remainder of my suggestions.

Irfy avatar Feb 21 '22 07:02 Irfy