Zero - Docker - Hackthon
Recently my college organised an inner hackathon to select teams for SIH (Smart India Hackathon). The motto of the hackathon was that each team would solve a problem from the problems mentioned in SIH's problem list and would build a solution to it in in 24-hour hack period. My team selected a problem from the Ministry of Ayush which focused on building a MedTech to identify different medical plants/raw materials used in Ayurvedic medicines/studies
Yogi eye
TECH STACK
BACKEND API: We chose FastAPI because I think it is a better alternative to Flask
DATABASE: POSTGRESQL & PgAdmin is just a personal choice also relational database made sense to our problem rather than a nonrelational
ORM: SQLAlchemy best choice in my opinion if you are using a SQL database and want your app to be SQL injection proof
ML ENGINE: PyTorch
ML MODEL: Efficient Net V_1 (pre-trained) It is a state-of-the-art model for image classification based on mobile net having 12M params
WEB CLIENT: React
APP CLIENT: Swift(IOS Version) & ReactNative for Android
DEPLOYMENT: deployed on AWS using docker container and ec2 instance
We also used Alembic to create automatic migration with the help of the Docker command. Axios to link React frontend to FastAPI backend. Roboflow for processing and hosting the dataset for training.
PROBLEMS FACED BY US BUILDING YOGI EYE
Unavailability of datasets for Ayurvedic plants especially Indian Ayurvedic Plants :
I read 8 to 9 research papers preparing for this hack most of them had data on how to design the CNN or which pre-trained model produces the best result in the case of plants but none of them had a link to a dataset they used. I also emailed a few researchers (some I know some I didn't) but either didn't have the dataset or they didn't reply. In the end, I had to make my own custom dataset, so I did what any normal person would do. I downloaded It from Google using this Chrome extension called Download All Images, but pre-processing each image one by one was impossible so I wrote some scripts to do it but couldn't achieve the required level I was expecting, then I stumbled upon this amazing website Robflow not only it preprocessed the image (Augmentation, segmentation, adding noise, Inverasion), split the dataset into Test/Validation/Train according to custom ratio given by me and hosted it and made it available using a simple API call.DOCKER:
Before this project, I had never used docker (deep regret) and none of my teammates knew either, So I as the team leader had to learn it. Damn, it's the most high-tech stuff I have learned in recent years. It's so awesome that it looks magical when it works. Implementing docker first time was a very tedious task as our application was almost a production prototype (annh maybe). I will explain it in depth in my future blogs (#follow lol).Preprocessing the uploaded image for the prediction function :
The image uploaded through the API route travels to backend in bytes but we need the image as ( 3, 256, 256 ) tensor for prediction function. So the code turned out to be like this :-
The prediction route looked like this in - - >
We had a few more issues but most of them got resolved pretty easily like none us knew how to link FastAPI to our React client app since I'm not good with frontend and was also busy deploying the docker container so one of team actually did small project tutorial in the last 3hr remaining and made it work. This is the most thrilling process I enjoy about Hackthons is where people learn things in such a short time that it would have taken atleast few weeks but was done in a few hours with practical confidence of applying it.
Repo for the done project is at Yogi-v1 free to clone it or contribute to it as my college will most probably not select my team, Open for any developer advice on it.
Feel free reach me at any of my handels
Subscribe to my newsletter
Read articles from Hari Om Bhardwaj directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Hari Om Bhardwaj
Hari Om Bhardwaj
Hi ! I'm a Noobgrammer trying to be a programmer. I hope I can help you.