Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The option to change the food art style to classic is now gone #70

Closed
JonathanRoiz opened this issue Oct 12, 2023 · 6 comments
Closed
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@JonathanRoiz
Copy link

There is no longer an option to use the classic food art style.

Using the standard food art style gives the error message below.

The testing steps in the readme file are also outdated for the current version of the game.

Error log:

(venv) (base) jonathanroiz@jonathans-MacBook-Pro super-ml-pets % python main.py --task deploy --infer_model rl_model_2048_steps
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
INFO main.py 58 Running...
INFO utils.py 72 Current display dimensions: (1728, 954)
INFO deploy_agent.py 97 INITIALIZATION [self.run]: Loading Model
INFO deploy_agent.py 100 INITIALIZATION [self.run]: Create SuperAutoPetsEnv Object
INFO deploy_agent.py 107 CV SYSTEM [self.run]: Detect the Pets and Food in the Shop Slots
INFO deploy_agent.py 109 CV SYSTEM [self.run]: Calls [image_detection.find_the_animals]
Traceback (most recent call last):
  File "/Users/jonathanroiz/SuperAutoPetsAI/super-ml-pets/main.py", line 65, in <module>
    main()  # pragma: no cover
  File "/Users/jonathanroiz/SuperAutoPetsAI/super-ml-pets/main.py", line 59, in main
    run(ret)
  File "/Users/jonathanroiz/SuperAutoPetsAI/super-ml-pets/smp/deploy_agent.py", line 111, in run
    pets, _ = find_the_animals(
ValueError: not enough values to unpack (expected 2, got 0)
@andreped
Copy link
Owner

To fix this we will have to update all food templates. For instance, this one of canned food.

This can be done by making small cropped snapshots around the food item, such that the computer vision system are aware which food are what.

Regarding the testing steps being outdated, it would be nice to know what needs to be changed.

Are you interested in making a PR?

@JonathanRoiz
Copy link
Author

Sure, I can at least update the readme, and possibly update the food templates.

@JonathanRoiz
Copy link
Author

It looks like the templates aren't the only reason I got the error. It doesn't look like the dimension scaling works on my 3456 × 2234 macbook pro.

@andreped
Copy link
Owner

Sure, I can at least update the readme, and possibly update the food templates.

Would be great if you could have a crack at it!

It looks like the templates aren't the only reason I got the error. It doesn't look like the dimension scaling works on my 3456 × 2234 macbook pro.

Screen resolution should have been fixed, see issue #17 (comment). But maybe it wasn't a proper fix. What are you observing to indicate that the dynamic screen resolution is not working?

@JonathanRoiz
Copy link
Author

If I wrote this correctly, this should scale the same way that your get_img_from_coords() method does. The image output doesn't seem to be correct.

import mss
import tkinter as tk
import numpy as np

def get_screen_scale():
    template_resolution = [1920, 1080]  # height, width
    curr_geometry = get_curr_screen_geometry()

    return np.array(curr_geometry) / np.array(template_resolution)

def get_curr_screen_geometry():
    root = tk.Tk()
    root.update_idletasks()
    root.attributes('-fullscreen', True)
    root.state('iconic')
    geometry = root.winfo_geometry()
    root.destroy()
    return np.array(geometry.split("+")[0].split("x")).astype(int)

dimensions_scale = get_screen_scale()

coords = (450, 620, 1500, 750)

coords = np.array(coords)

coords[0] = coords[0] * dimensions_scale[0]
coords[1] = coords[1] * dimensions_scale[1]
coords[2] = coords[2] * dimensions_scale[0]
coords[3] = coords[3] * dimensions_scale[1]

coords = tuple(np.round(coords).astype(int))

with mss.mss() as sct:
    sct_im = sct.grab(coords)
    mss.tools.to_png(sct_im.rgb, sct_im.size, output='img.jpg')

img

@andreped andreped added the help wanted Extra attention is needed label Nov 7, 2023
@andreped andreped assigned andreped and unassigned JonathanRoiz Jan 10, 2024
@andreped
Copy link
Owner

Fixed in 5ce7b66.

All pets and food item styles have been updated to the new, default style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants