Sagar Patil


About Me

Hi there! I am a student at Purdue University majoring in Computer Science

Projects

Marching Cubes

The marching cubes algorithm is used to generate a 3D surface out of a scalar field. As a side project, I wanted to implement the Marching Cubes algorithm efficiently in the Unity3D game engine to generate interactive, procedural terrain.

The first method I tried was to write the algorithm in a compute shader. However, this proved to be too slow due to time it took to move the vertices from the GPU back to the CPU.

After that, I tried to implement the algorithm in Unity's Job system, which allowed for automatically parallelized tasks. This offered a significant speed benefit.

In order to make the terrain editable, I also added a chunking system, so that the terrain could be split into chunks and only one chunk had to be regenerated when the underlying voxel data changed.

The code for this project can be found on GitHub.

Rocket Test Stand

Over the summer, I wanted to build and test custom solid rocket motors, so I built a test stand to measure the thrust of motors.

To achieve this, I used a load cell along with an ESP 8266 microcontroller, to read the load cell and transmit the data.

All the code that runs on the ESP was written in C++ using the Arduino ecosystem.

The program on the ESP was responsible for reading the data from the load cell, storing the data in SPIFFS, sending data over TCP to connected clients, and broadcasting mDNS.

An electron app was created to recieve and visualize the data. The electron app used mDNS to find the IP address of the ESP, and then recieved data on a TCP socket. It uses uPlot to graph the data in real time, and also records the data.

Finally, it includes an interface to perform various functions on the ESP, such as starting/stopping data collection, downloading onboard data, and calibrating the load cell.

All the code for this project can be found on GitHub.

NLP Discord Chatbot

After gaining a bit of experience in working with natural language models and the transformers Python library, I wanted to make a Discord chatbot for a server that me and some of my friends were in.

The picture above shows the chatbot in action. As you can see, it is called AMOGUS for comedic effect, in reference to the popular pandemic game Among Us. You can also see that the bot does not know how to perform multi-agent reinforcement learning, which is expected behaviour.

The first hurdle in making a Discord bot was communicating with Discord servers. Thankfully, there was already a Python library that abstracted all of that away into a simple Flask-like interface.

I then made an abstraction to keep track all the conversations that the bot should be handling. I did this so that I could isolate conevrsations between different users, as the chatbot model I was looking to use did not seem to support having multiple people talk in a conversation.

For the NLP model itself, I decided to go with Facebook's pretrained Blenderbot model. Before choosing this model, I experimented with other models such as DialoGPT, but many of them had problems with the model getting repetitive, and I was not able to fix that problem with different sampling parameters.

I also added an abstraction for the model itself, so that I always have the option of switching between different natural language models. I am currently working on getting the GPT-J model working with the Discord bot, and while the model is a tad bit overkill, it seems to be good at keeping track of multi-user conversations, which is a feature I had always wanted to add to the bot.

I am also currently working on optimizing the server code so that it can run fast on a server with multiple GPUs and automatically schedule text generation tasks.

The code for this project can be found on GitHub

Summarizer Chrome Extension

For the HackJPS hackathon, my friends and I decided to create a chrome extension that could summarize articles. However, we didn't want this extension to be like the usual summarizer which just extracts sentences that are already in the article.

In order to achieve this, we decided to use a natural language transformer model to perform the summarization.

First, we needed to extract text from any article, so we used a library called mercury-parser. On the backend side, we used Python with Flask. For the summarization model itself, we used a version of BART finetuned on the CNN/DailyMail dataset.

We also attempted to quantize the model using ONNX in order to run it on users' machines, but that wasn't possible within the scope of the Hackathon. Regardless, we were able to win the hackathon. We completed the entire project, start to finish, in the span of just a few hours, which we thought was fairly impressive.

More information about the project can be found on DevPost and the code can be found on GitHub.

HawkVision

Hawkvision is a computer vision project I developed during my time at the FIRST Robotics Team 2554.

The goal of the project was to track a target marked with retroreflective tape. The camera that we used on the robot had a green ring light on it, so that the vision target appears bright green on the camera view.

To track the targets, we used a program called GRIP to build an OpenCV pipeline with color thresholds that narrowed out the vision target. We also calibarted the camera and found its focal length to determine the angle to the target.

With this information, we were able to run a PID loop on the robot so that it could automatically align with the target on command.

The code for this project can be found on GitLab.