Skip to content

Project of an intelligent autonomous garbage truck that implements most important learning methods in artificial intelligence. Created for Artificial Intelligence classes in the summer semester of 2020/2021 at Adam Mickiewicz University in Poznań with @HondaPL, @SmoothCrimminal and @Maciasty15.

Notifications You must be signed in to change notification settings

kgaleziowski/intelligent-garbage-truck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Intelligent Garbage Truck

Implementation of intelligent autonomous garbage truck that travels by path with the lowest cost (TSP problem solved with genetic algorithms) from garbage to garbage, collects garbage if circumstances allows to do so (decision trees classification) and recogonizes type of garbage that is in trash (neural network object recognition). Agent uses BFS and A* algorithms implementation for state space searching, agent environment is highly configurable. Agent can turn left, right and move forward by one unit with cost of 1. If he moves through obstacle it has additional cost of 10. Agent with A* algorithm toggled will always consider that cost and with help of genetic algorithms traversal of all trashes will be always close to optimal.


Project contains:

✔️ Agent environment in the form of a tile map generated from a .tmx configuration files

✔️ Agent movement within environment, state space traversal.

✔️ Implementation of state space searching with BFS (Breadth-first search) algorithm

✔️ Implementation of state space searching with heuristic algorithm A* and Manhattan distance.

✔️ Implementation of decision trees for making decision about picking up garbage under current circumstances based on 8 parameters (even/odd day of the week, size of garbage, weight of garbage, paid bill, can/cannot close bin, free space, type of garbage, time of a day), model training, learning set, extracted trainer for model

✔️ Implementation of neural networks for recognizing four different types of garbage (plastic, paper, glass, mixed) based on given picture. Model training with keras using multiple layers and saving it to file.

✔️ Implementation of genetic algorithms for solving traveling salesman problem: cost matrix generation, chromosome adjustment to environment, mutations, elitism, crossover, ranking, mating pool, all parameters can be easily changed (population size, elite size, mutation rate, number of generations), generation of plot for cost optimision obtained by genetic algorithms.

✔️ Clear HUD that shows what is happening in the agent's environment at the moment (including picture of garbage).

✔️ Dataset containing nearly 1000 pictures of each type of garbage (plastic, paper, glass, mixed)

✔️ Access to configuration files which allows to play with generated environment


Video demonstration (autonomus mode):

Just press space after opening application

Autonomus.mp4

Video demonstration (free mode):

Select location with left mouse click and then:

  • Press O to place obstacle
  • Press T to place trash
  • Press A to change state space searching algorithm
  • Press S to save current map configuration (location of obstacles, trashes) - more information at the end of this file
  • Use right click on location to make garbage truck drive to this location by road found using currently selected algorithm (you can compare difference between A* and BFS in that way in very nice way with obstacles)
Free.mp4


This video shows that agent chooses longer road if it has lower overall cost but there is much more to check - try it yourself!


Agent environment:

s1

s2

s3


Dataset samples (examples of glass/paper/plastic/mix):

glass (20)

paper (131)

plastic (13)

mix (648)


Genetic algorithms plot visualization of cost optimisation (different parameters):

PLOT-003

PLOT-002

PLOT-004

PLOT-008


Technology stack:

  • Python Programming Language

  • PyGame library

  • Keras library

  • PyTorch library

  • Sklearn library

Requirements:

1. Install Python 3.x (version 3.9 is recommended)

2. Install pygame library

3. Install numpy library

4. Install torch library

5. Install tensorflow (version 2.8.0) library

6. Install torchvision library

7. Install pytmx library

8. Install scikit-learn library

9. Open project ("intelligent-garbage-truck-main" folder) under PyCharm IDE

10. Run main.py

11. Press space when after everything is loaded

‼️ If any library is missing, just install it according to the information returned by ModuleNotFoundError. ‼️


Additional features:

✔️ User can load multiple configurations in settings.py file and also create his own configurations according to instructions in file "GA-How to use.txt".

✔️ User can easily change used algorithm for state space searching by pressing A key (A*/BFS).

✔️ User can analyse optimise obtained by genetic algorithms by checking plots generated in configurations folder 001, 002, etc.

✔️ All important information is logged in real time to the console and can be verified.

About

Project of an intelligent autonomous garbage truck that implements most important learning methods in artificial intelligence. Created for Artificial Intelligence classes in the summer semester of 2020/2021 at Adam Mickiewicz University in Poznań with @HondaPL, @SmoothCrimminal and @Maciasty15.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages