PaddleClas/deploy/shitu_index_manager/client.py

46 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import mod.mainwindow
"""
完整的index库如下:
root_path/ # 库存储目录
|-- image_list.txt # 图像列表每行image_path label。由前端生成及修改。后端只读
|-- features.pkl # 建库之后保存的embedding向量后端生成前端无需操作
|-- images # 图像存储目录,由前端生成及增删查等操作。后端只读
| |-- md5.jpg
| |-- md5.jpg
| |-- ……
|-- index # 真正的生成的index库存储目录后端生成及操作前端无需操作。
| |-- vector.index # faiss生成的索引库
| |-- id_map.pkl # 索引文件
"""
def FrontInterface(server_ip=None, server_port=None):
front = QtWidgets.QApplication([])
main_window = mod.mainwindow.MainWindow(ip=server_ip, port=server_port)
main_window.showMaximized()
sys.exit(front.exec_())
if __name__ == '__main__':
server_ip = None
server_port = None
if len(sys.argv) == 2 and len(sys.argv[1].split(' ')) == 2:
[server_ip, server_port] = sys.argv[1].split(' ')
FrontInterface(server_ip, server_port)