So, it is already time for Second Evaluations! July was a pretty harsh month for me as I had 3 exams and I had to go back to my home country (Kazakhstan) from Germany where I study Data Analytics (this post was partially written in a train, airport and a bus 😛). During the period since my last post, I have been focusing primarily on Web App and REST API, about which I will talk in this post. But first…
Face Expression Recognition
This is the last type of models that I listed in my proposal (but not the last for this project, as I am going to add object segmentation, facial characteristics models and many more). Unfortunately, there has been not much progress in this field and thus I used a 2–3 years old model. Still, this model is enough for an initial try.
This model is based on PyTorch and it is capable of recognizing 7 basic emotions such as ‘Angry’, ‘Disgust’, ‘Fear’, ‘Happy’, ‘Sad’, ‘Surprise’ and ‘Neutral’. As you can see in the pic above, it works pretty well for a wide range of basic cases.
Continuing to work on Web App
Web development is like LEGO — brick after brick you are building your website, being able to see the results of your decisions almost instantly. When I was a kid I was limited by the amount of different LEGO bricks and parts I had, whereas with web development time and knowledge are the biggest constraints for me 😀. Creating a Web App is a very immersive process and I already have new features ideas rolling around in my head.
New Task Manager Interface
First of all, Web App was moved to a separate repository for better components decoupling and now you can see that PMR’s repository is 100% Python 😀.
The Task Manager that is also the main page was updated — now to submit a new task you will need to click on a red “Add Task” button, which in turn opens a modal window with a possibility to submit a task of one of the 3 task types — Video, Images and YouTube video.
File Uploader is based on AJAX meaning that you will be able to send your file asynchronously and see uploading progress. Once your file is uploaded, you will need to click “Submit Task” button to start processing it. In my 3rd stage of GSoC I am going to add “Pipeline Constructor” to allow choosing a specific pipeline for a task.
User Panel is a new feature and currently, it is used only for displaying how many files did the user uploaded and also for generating the API token.
I will talk more about API token in the next section but for now, just remember that User Panel is your first step towards PMR’s REST API.
REST API v1
As this is the first time I am designing API, I was reading and thinking a lot about how to design a secure and efficient REST API that would mimic all the functions of Web App. Keep in mind that even if the current API already allows a user to do tasks like submitting files and getting processing results, it will be heavily upgraded in the coming month.
In order to perform authentication with REST API you need to obtain an “Access Token” that must be included in every POST request to API. You can get it in User Panel by clicking “Get API Token” button. The token will be generated for you for the first time, but you can regenerate it anytime by clicking “Generate Token” button. Once you obtained your token, you can test it by sending POST request to http://pmr.example/api
Uploading Files using API
Your first step for adding a new task with API is to upload your file. This can be done using POST request to http://pmr.example/api/uploadfile with Access Token and URL to your file. For now, PMR’s API only supports downloading files but in the next stage, I am going to add resumable file uploads using https://tus.io.
Handling Tasks with REST API
Don’t forget to write down “file_id” as you will need it for this step! To submit a new task just send a POST request to http://pmr.example/api/addtask with file_id and you will get id of a new task.
By sending “task_id” to http://pmr.example/api/task you can get the current status of your task. Once the processing is finished, json_data will be filled with all the data from a pipeline (e.g. recognized persons, names, facial expressions, etc.)
Second Evaluations and Future Work
With that, I conclude the second stage of GSoC 2019. During this stage, I have added two new models, updated and created main functions of Web App, implemented the basic REST API and most importantly improved Face Recognition results. I still have to start working on Native Bindings and finish building a huge celebrities dataset and all this will be done in the next stage.
Moreover, in the next stage, I will add various data visualizations tools (timeline of a person, video statistics, relations between persons, etc.) and custom pipeline builder. If time permits, I will also add several new types of models.
As usual, thank you for reading yet another post and stay tuned for future updates!
Originally published at http://fedoskin.org on July 25, 2019.