[DOCKER] An app for smart people and smart people

It is the last day of the Advent calendar. Hooray Yesterday, @starcoop shared the flow of investigating the cause of the error in The story of a 503 error on Heroku open!

Today is the story app times.

What was made

Former story

Stupid person

"The more you look at things and the more you associate with them, the smarter you are", so I tried it because it seems like a mock. In addition, the right of the character? I was scared, so I replaced it with an emoji.

Overview

As an element

--Web application - FastAPI - Vue.js --Object detection - PyTorch - VGG16(ImageNet) --Knowledge graph - ConceptNet --Graph database - Neo4j

Will appear. As a flow

  1. POST images from the front to API
  2. Detect objects in the image
  3. Convert object names from English to Japanese
  4. List by tracing the network from Japanese object names
  5. Return to the front desk to remind you

it's dark.

About each element

Make a note of what it was like.

Web application

FastAPI

A little stumbling block is how to receive and process the uploaded image file. I referred to here. How to convert the uploaded image to Numpy array? #2376

When making a mock with FastAPI (it will be my own quote), I think it is easy to have index.html read. You can easily use a built front or a light one using a CDN. Static file in Fast API, index.html setting (fix WebSocket Chat example)

Vue.js

The UI used Vuerify. Both Vue.js and Vuetify used CDNs in index.html Peraichi rather than in the front.

Object detection

PyTorch

There is no big reason, but I like how to write when using GPU and I often use PyTorch.

VGG16(ImageNet)

This time I used the pretrained model. TORCHVISION.MODELS

As with Hugging Face, which processes natural language, it's very guilty to be able to move deep things. However, be aware that the conditions must be the same as when learning. This site is always very helpful. PyTorch (7) VGG16 --A Breakthrough on Artificial Intelligence

Knowledge graph

I used the knowledge graph to follow the association. The first proposal considered Microsoft's Concept-Graph, but only for academic use. So I decided to use ConceptNet.

ConceptNet

Many relationships such as Synonym as well as IsA are stored. I think it's fun just to play a little on the Official Page.

WebAPI is also open to the public, but I decided to download it and store it in the database. The GitHub Wiki is extensive. commonsense/conceptnet5

Also, although it is not an exact method, each Node also holds a Language, so you can follow the Synonym relationship and get a "banana" (ja) from "banana" (en). As we'll see later, sometimes things don't work.

Graph database

I chose Neo4j because I wanted to touch it.

Neo4j

The documentation is easy to understand, and there are also Docker and Docker-Compose materials. How-To: Run Neo4j in Docker

The storage method of ConceptNet and Concept-Graph mentioned above is also shared. Non-Text Discovery with ConceptNet as a Neo4j Database [Community Post]

In addition, Neo4j's management screen WebUI has a tutorial on relationship graphs related to movies, such as "I co-starred with actor A's co-star" but "I'm not an actor A's co-star" We also handle. It's fun.

in conclusion

Instead of riding on the shoulders of giants, I felt like I was fighting on horseback by using datasets and pre-learned models. However, in fact, when I converted "banana" to Japanese, I chose "Amabu" and couldn't trace the relationship so much, or I'm making fine adjustments, so I'm planning to update it including the code.

It's an impression that I finished the race, but I'm glad that many juniors participated, so please do your best. Thank you to all the Advent Calendar participants! I'll eat cake ~~

Recommended Posts

An app for smart people and smart people
Simple management app for download images and face images
Make your python CUI application an app for mac
Creating an execution environment for Chef-Zero / Solo and SoftLayer CUI
Create an automatic grade management app for Tenhou private room with LINE bot and Python Part 1
Create an automatic grade management app for Tenhou private room with LINE bot and Python Part 2
Pitfalls and workarounds for pandas.DataFrame.to_sql
Qt for Python app self-update