TensorFlow Object Detection faster CS:GO aim bot



Original Source Here

Welcome to part 8 of the TensorFlow Object Detection API tutorial series. First, you can download the code on my GitHub page. Then, in this tutorial, I will show you how to export the newly trained model, and we’ll test it out.

So in the previous tutorial, we made a final working model, which shoots enemies. Still, our FPS was really slow, so I decided to try training another model to talk about it in this tutorial.

I used almost all the same files from the 5th tutorial part to clone my GitHub repository if you don’t have them yet. In this part, I am not covering how to label pictures, generate tfrecord or configure our training files. I already did this on my 5th tutorial. In this tutorial, I will cover only what was not covered before.

At first, I trained the model in the 5th tutorial. After that, I used the faster_rcnn_inception_v2_coco model, and now I decided to train ssdlite_mobilenet_v2_coco. This model detects objects 21% worse, but it is 53% faster, so I decided to give it a try. Here is the link to all models, so download one if you decided to train the model by yourself.

This time when I try to use the train.py file it said that I was using the wrong training method and offered to use the model_main.py file. So I uploaded it if someone has problems finding it. I faced some problems when I tried to start it training the model, there was some error, but I didn’t make a note about them, so I can’t tell it exactly, so if you face errors, write it on YouTube comments, we’ll try to solve it.

When training the new model, I used the same file structure, so you will need only to update ssdlite_mobilenet_v2_coco.config the file and download the pre-trained model. From TensorFlow/research/object_detection folder continue with following line in cmd:

python model_main.py --alsologtostderr --model_dir=CSGO_training_dir/ --pipeline_config_path=CSGO_training/ssdlite_mobilenet_v2_coco.config

The model training process will not show steps as it was doing in the 5th tutorial. Still, the training routine periodically saves model checkpoints about every ten minutes to the CSGO_training_dir directory. So you should check how your training is going in TensorFlow TensorBoard. You can do so with the following command:

C:\TensorFlow\research\object_detection>tensorboard --logdir=CSGO_training_dir

These few lines of code were only for one object, and we do this for all four objects:

I was training my model since I saw that my loss curve stopped dropping. It took me close to 24 hours, and I did around 21k training steps:

Then I used the same export_inference_graph.py script as we used in the 6th tutorial. From command prompt issued the following command, where “XXXX” in “model.ckpt-XXXX” should be replaced with the highest-numbered .ckpt file in the training folder:

python export_inference_graph.py --input_type image_tensor --pipeline_config_path CSGO_training/ssdlite_mobilenet_v2_coco.config --trained_checkpoint_prefix CSGO_training_dir/model.ckpt-XXXX --output_directory CSGO_inference_graph

In the final step, we took all files from my 7th tutorial and replaced CSGO_frozen_inference_graph.pb file with the newly trained inference_graph.

Next, we tried to play CS: GO, and I let my bot shoot enemies. You can check this out on my YouTube video.

With the new model, I didn’t solve the FPS problem. It improved performance slightly but not that we could play our game. So for future work, I decided to learn to do stuff on multiprocessing and run our code processes in parallel. So in the next tutorial, I will be doing stuff with multiprocessing. That’s all for this tutorial.

AI/ML

Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot

%d bloggers like this: