Web Framework
Our web is built by flask, which is a microframework for Python. We used wtforms to generate a form for user information registration. For face registration, we wrote a webpage using HTML and JavaScript, which will be explicitly explained in section 2.3. Firstly we call the web camera by mediaDevices API and play the video on the webpage. Then we use the canvas to capture the video and convert to an image and send back to backend using Ajax POST method. The backend will then process the data from Ajax and detect faces in the image. Then it will make a response to the frontend to tell if the detection is successful.
AlgorithmsThe algorithms were the key to improve elevators performance. There was how the proper allocation strategies generated. To implement the proper allocation. The general idea for such allocation is arranging individuals going to the same floor to the same elevator. We used the strategy similar to Huffman Coding, which minimizes the entropy of an allocation system. First, the whole group of people is split into small groups by their destination floors. Then, the algorithm combines the smallest two groups into a larger one until there are only three groups. Finally, those three groups of people were allocated to three elevators. The logic of this algorithm is to allocate those relatively small groups to one elevator, so the larger groups of people’s travel time are improved due to fewer stop times.
Pseudocode: Split people into groups by floors List a = groups sorted by size If len(a)<3 Return allocation If len(a)>3 Merge the first two elements Sort the new list a again. Keep doing the “merge” of a until len(a)<=3 Finally return the allocation |
Face recognitionFace recognition part is implemented using the open source library on GitHub. For face registration, we basically catch each frame of the video and for each frame, we encode each face into a float list of 128 lengths and store these encodings by DynamoDB. For face matching, we will encode the faces in the video in the same way and compute their distance between those faces stored in the Database. And the one with the shortest distance within the tolerance will be considered to be the matched user.
|