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

can you provide a colab version #1

Open
deathwing573 opened this issue Dec 9, 2020 · 2 comments
Open

can you provide a colab version #1

deathwing573 opened this issue Dec 9, 2020 · 2 comments

Comments

@deathwing573
Copy link

No description provided.

@bobhope9848
Copy link

Please

@mex3semmen
Copy link

mex3semmen commented Oct 24, 2021

You can use the code provided in the video. This code works.

[1] !pip install pandas --upgrade

[2] !pip install fastai --upgrade -q
from fastai.vision.all import *
from google.colab import drive

[3] from google.colab import drive
drive.mount('/content/gdrive', force_remount=True)

[4] !ls '/content/'
!tar -xvf "/content/gdrive/MyDrive/GateCrash.tar.gz"

[5] !ls '/content/GateCrash'

[6] path = Path('/content/GateCrash')
fnames = get_image_files(path)
print(f"Total Images:{len(fnames)}")
def label_func(x): return x.parent.name
dls = ImageDataLoaders.from_path_func(path, fnames, label_func)

[7] dls.valid.show_batch(max_n=8, nrows=1)

[8] learn = cnn_learner(dls, resnet18, metrics=error_rate)

[9] lrs = learn.lr_find(suggest_funcs=(minimum, steep, valley, slide))

[10] learn.fine_tune(2)

[11] learn.path

[12] learn.export('mymodel.pkl')

The numbers infront of each segment representing the cells.
The results of the AI might not be that good, due to the fact, that only 1 keypress is recognized and saved with an image. So if you play a racing game, you would want (w+d) or more keypresses.

Also you might want, that your keypresses/ mouseinputs and images are automaticly stored and sorted into the folders.
I made it recognizing multiple keypresses/mouseinputs and sorting those into the folders, so i just need to compile those folders as .tar.zip

Also the trained Agend will also only be able to press 1 key at a time. You need to adjust this too.
Otherwise this project would be a toy, to get into behavioural cloning.

This approach is heavily depending on the base code. e.g. The provided code always presses "w". In FallGuys you don't have multiple keystrokes, because you only press "a" or "d". So what you might want to add:

  • multiple keystrokes
  • mouse inputs
  • automaticly sort the images into the folders, for those keys/mouseinputs used in the specific game
  • make the trained agent able to press multiple keystrokes

Also [10] learn.fine_tune(2) : 2 epoch are more then enough, if your agent, don't behave like you want, then you should change the base code. The agent only can do stuff, based on the data it was given.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants