Reinforcement learning agent with visual inputs

As the module “individual profiling” in university, I created reinforcement learning agent working only on visual inputs, which could generally control anything on the computer. It was mainly built to play a certain video game, but can (in theory) generalize to do anything with visual input. It just needs an interface class to be written which converts the outputs to the desired thing to do.

For more information, visit the GitHub repo of the project (there is also in-depth documentation of the creation of the project).

Here are the two main examples used to show the best progress in two different games:

1. Driving nightmare (a game jam game created by a team of three people including me)

    This diagram shows the learning progress over 1600 iterations. The green line representing how long each run was (the higher the better) with the yellow line showing the average. The “loss” in blue being how far off the model thinks it is from the expected result.

    2. A simple Flappy bird like program built specifically for the AI. The flappy bird game can be advanced by code in specific steps, so it can wait for a slower working network without dropping any inputs.

    (Math:) Projective space visualizer

    In my university module “Higher Mathematics” we learned about projective space and the different representation with the hemisphere. (Or as we lovingly called it: “salad bowl”) This was part of the basics to understand Elliptic-curve cryptography.

    Since I had a hard time wrapping my head around the secondary representation of projective space, I decided to create a visualizer in the game engine I was familiar with at the time: Unity3d. I built a very crude module that can creates a 2D plane with a translucent mesh which can morph between the two representations. And I also added the intersecting lines together with the points to visualize where the points are at all times. This helped me understand the topic more deeply and didn’t take too much time to make.

    Since it wasn’t planned to be a finished project, it is not really polished, but you can still find the working unity project on the GitHub repository: https://github.com/MisterIXI/projective-space-visualization

    Bachelor Thesis: Non Destructive Reverse Engineering of PCBs

    Full title of the thesis: Non Destructive Reverse Engineering of Printed Circuit Boards using
    Micro Computed Tomography and Computer Vision

    This post only aims to illustrate the main contents of the bachelor thesis, for the full overview, the original paper is best read in it’s full form.

    Here is the abstract of the thesis:
    Reverse engineering (RE) of printed circuit boards (PCBs) is used for a variety of purposes, such as in computer forensics and quality assurance. Usually RE is very labor-intensive or destructive, since it pertains either manually measuring all visible contacts, including desoldering the components for the covered pads and mapping them out individually, or the process is done by milling away layer by layer to see inside the object and uncover the traces. This thesis aims to automate the process as much as possible while being non-destructive. To achieve this, micro computed tomography (µ-CT) will be used to scan the PCB while information will be extracted with the help of computer vision.


    The thesis researches the possibilities of using x-ray to reverse engineer PCBs. This makes it possible to understand PCBs without the need of damaging them using different methods.

    The program was not finished at the end of the thesis, since the reconstruction part was still missing, but the whole procedure was shown to work in theory. Here are a few pictures taken from the thesis to visualize the problems:

    Left to right: CT scan, pre-processed CT scan, edge detection visualized, original picture

    This is a comparison of the fix by tilting the PCBs when scanning in a certain way:

    This picture shows the edge detection up close and explains the coloured lines:

    The picture below shows the algorithm recognizing two traces on the PCB

    High performance and high volume processing and rendering of low-poly 3D ants in Unity3D

    As an experiment to play around with multi-mesh-instancing and compute shaders in Unity, I created a small project to render as many moving 3D low-poly ants as possible at the same time. Each ant was vertically offset by a few units and each was just pseudo randomly walking until hitting the virtual boundaries of the square. This was all done in a compute shader, and the result then rendered by the mesh-instancing unity provides.

    This way, it was possible to render ~900k ants moving around all visible at the same time with stable 13 FPS. (This was achieved with a AMD Ryzen 9 5900X and a NVIDIA Geforce RTX 2080 Ti) To force them to be rendered at all times, an orthographic camera from above was used, which always sees all the ants.

    Here is the link to the GitHub repository.

    Here is a short video clip of them in motion, but of course with that many small moving objects, the bitrate suffers very much.

    Mixed reality online multiplayer board game simulator in Unity 3D

    Together with a teammate, I created a multiplayer MR experience in which you can play Chess and Go. This was for the module “Windows App development” Used for this project was Unity3D, MRTK and PUN2. Check out the description and code on the GitHub repository.

    The project was made to work on an Augmented Reality device such as the Microsoft HoloLens and Virtual Reality Headsets such as the HP Reverb. The idea was that two players could connect with either platform and play with each other. Initially there were plans to integrate the table recognition of the MRTK for the AR devices, but that was scrapped due to time constraints.

    In the end, project had the following features:

    • peer to peer Online Multiplayer
    • AR and VR support
    • Builtin Chess and Go modes (no rules, just board and figures)
    • import of custom games with board texture, 3d models, snap positions, etc.
    • control with hand gestures for AR (Hololens)

    Note analyser

    As a university project for the module “Multimedia”, I was in a team to develop hardware which would recognize single notes or cords being played on an instrument (tuned to piano sounds).

    The project was run on a Raspberry Pi, and used the Fast Fourier Transformation to get the information needed. For a full writeup you best checkout the GitHub repository and the Printables entry.

    Dodge-Box – a learning/university project

    Dodge-box is a university project for the module “Software Engineering” in which we were supposed to do some sort of programm in a group with version control. We, as a group of three, decided to do my go-to learning project “Dodgesquare” in javafx.

    We didn’t have all too much time, so the project ended up pretty crude, but it works and we got a good grade.

    GitHub repo: https://github.com/MisterIXI/dodge-box

    Automated Backup via Robocopy in Powershell

    Finally I got around to actually set up a Backup routine for my Hard drive to my little Raspberry Pi “NAS”.
    I decided against any fancy Software and went straight to robocopy to mirror all my files. This has the added benefit of being able to browse the files normally, but it lacks any form of compression or security by itself. For me that is enough for now though, so I went with it.

    The script is fairly simple. It basically first copies a few selected User related files from my C: drive to the appropiate folder on my HDD and then Mirrors the whole tree from D:\ downwards over to my Samba share on my RasPi.
    I needed to include some exceptions though.

    I replaced some personal Information in my script for security reasons, but here’s the whole script:
    Write-Output "Starting Backup at $(get-date -f yyyy-MM-dd--hh:mm:ss)..." >> \\192.168.[...]\[Sharename]\Backups\Logs\$(get-date -f yyyyMMdd)WindowsBackupScript.log
    Write-Output "Exporting Programlist" >> \\192.168.[...]\[Sharename]\Backups\Logs\$(get-date -f yyyyMMdd)WindowsBackupScript.log
    $tempCSV = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, UninstallString | where DisplayName -NotLike *Microsoft*
    $tempCSV += Get-ItemProperty HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, UninstallString | where DisplayName -NotLike *Microsoft*
    $tempCSV | Export-Csv D:\UserBackups\ProgramExport.csv
    Write-Output "Copying User Stuff to Mainspace..." >> \\192.168.[...]\[Sharename]\Backups\Logs\$(get-date -f yyyyMMdd)WindowsBackupScript.log
    robocopy 'C:\Users\[Username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\customLinks' D:\UserBackups /MIR /Tee /Z
    Write-Output "Backing up Mainspace..." >> \\192.168.[...]\[Sharename]\Backups\Logs\$(get-date -f yyyyMMdd)WindowsBackupScript.log
    cd D:\
    robocopy D: \\192.168.[...]\[Sharename]\Backups\[PC-Name]\Mainspace /MIR /LOG+:"\\192.168.[...]\[Sharename]\Backups\Logs\$(get-date -f yyyyMMdd)robocopyD_log.log" /Z /XD D:\Steam "D:\other games" D:\HyperV D:\`$RECYCLE.BIN D:\Recovery "D:\System Volume Information" D:\config.msi -np -ndl -tee
    Write-Output "Finished Backup Job at $(get-date -f yyyy-MM-dd--hh:mm:ss)" >> \\192.168.[...]\[Sharename]\Backups\Logs\$(get-date -f yyyyMMdd)WindowsBackupScript.log
    Read-Host -Prompt "Finished all Backups. Press Enter to open the Logfile(s)."
    & 'C:\Program Files\Notepad++\notepad++.exe' "\\192.168.[...]\[Sharename]\Backups\Logs\$(get-date -f yyyyMMdd)robocopyD_log.log"

    So, what does my script do?
    I wanted to have a log of when the script does what, so I included “comment” lines which output what the script does to the log file.

    In a case of me having to reinstall Windows from scratch I decided to have some sort of list of installed programs. Backing up the installers or executables felt like a weak way to do this though, so I let powershell grab the installed programs from the registry directly and let it compile into a csv file.
    $tempCSV = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, UninstallString | where DisplayName -NotLike *Microsoft*
    I decided that I’d filter out everything with “Microsoft” in the name so I wouldn’t have all the restributables and stuff cluttering the list. This way a few actual programs get filtered out, but most of them are obvious enough for me to not be important in that list.
    Anyway, this should help me remember the various programs I installed, just in case.

    robocopy 'C:\Users\[Username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\customLinks' D:\UserBackups /MIR /Tee /Z
    This little line copies the custom links I created so I can just type in the script names to run them.

    Bananasplit

    What is Bananasplit?

    Bananasplit was my first “big” programming project that I actually finished. After countless small programs I created in Delphi including some sort-of games I had a goal to actually make something that has not existed before.

    This program is a splitter specialized on speedrunning MKDD (Mario Kart: Double Dash!!) specifically in the ACT (All cup tour) category. After being part of that community for a while I realized the need of such a tool and started programming a prototype in Delphi with the Pascal language.

    I oriented myself on the design of Livesplit and also used the open source code of it as a sort-of guidline while coding.
    GoombaNL really helped me improve the design of the whole thing.

     

    Why create this if stopwatches/livesplit already exist?

    The reason for this program is solely to have splits for your run. This means that you can compare your segments with your record and see how well you are doing instead of relying on your feeling.

    A lot of people think you can just use livesplit, but the problem is that the track order for the tracks 2 to 15 are random. Livesplit can (at least to this point) only have a fixed order of splits.
    And since the tracks vary in length it does not work to use splits like “Track1, Track2, …”.
    I personally like having splits, but some people don’t care about that that much.

     

    You can download the program either on speedrun.com or directly here.

    If you want to see the source code just shoot me an e-mail here yannik.braendle@gmail.com and I’ll gladly provide you with the project files.

    Dodgeblock

     

    In Order to learn more about using the Unity3d engine, as well as programming C# scripts, I wanted to re-iterate the idea of my first game programmed in Pascal in Delphi. (To check out the post about that project click here) This game takes the basic ideas of my old game I just mentioned and adds expands on it further. The main difference is that through the 3D engine used all the objects can now move freely on the two axis of the game field, and additionally implement physic simulation into the mechanics. Through that the blocks can push each other around or have new types of movement (like the purple momentum based blocks).

    You can download the game & files here: