holydeew / AI_League_of_Legends

Shoot "Auto Q skills" on the enemy on Image Recognition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shoot "Auto Q skills" on the enemy on Image Recognition

Based on the image recognition, the model that I create with 1,500 pictures is able to detect the enemy on League of Legends and makes ezreal shot "Q" to the enemy on the coordinate of x and y axis.

Explaination (Classification and Object Detection)

1. Images

I respectively save 500 images of Tower, Minion, and Ezreal on League of Legends (Total 3 classes)

  • Used parser or tf.run.flags to insert width, height, and filename
  • Used cv2 to take each 500 pictures
  • Saved those pictures with np.save(The size of .npy is 233.4 mb)

1

2. Model

:Used AWS to use GPU that has p2.x2large to operate model. I have used 3540 epochs on GPU based on Object Detection.

4

3. Tensorboard(the function of early stopping is in the file, model.py)

5

4. Result - Shooting "Auto Q skills" on the enemy

Watch the video

Installation

  • You can install some packages, tensorflow, argparse, pillow, and numpy

pip install -r requirement.txt

How to Use Classification and Object Detection

  1. To create .npy and 500 pictures, use tf_save_image.py

python tf_save_image.py --filename LOL_data.npy

  1. If you run it, the file LOL_data.npy on the folder of data is created and 1,500 images are saved on the image folder of images.

  2. To seperate LOL_data.npy into two groups, train_data and image_data, you might as well use tf_load_image.py

python tf_load_image.py --filename LOL_data.npy

  1. To create a model, you might use model.py that has CNN mode(I used early-stopping with patience = 5 and made the model stopped actumatically, also made use of Dataset API)

python model.py python prediction.py

  1. To make the box on the picture, ImageGrab on Pillow and Tensorflow Object Detection API might be used to detect ezreal, tower, and minion

  2. To detect and controll ezreal automatically, you might use contoller.py

python controller.py

Watch the video

About

Shoot "Auto Q skills" on the enemy on Image Recognition


Languages

Language:Python 100.0%