Project description

This project is based on PySide2 and PyQt5 interface design UI, with QT Designer interface design. Based on Keras model in TensorFlow, the garbage classification model is trained. The project includes the following functions: user registration and login function, administrator training model, user classification using model.

Function is introduced

1. Register and log in

  1. SQLite database is used to store account data. During registration, user properties (administrator or user) are selected as the differentiators for subsequent system logins. The data stored mainly includes the user name, password, and user nature. The user name serves as the primary key and is uniquely identified.
  2. During registration, fill in the user name and password, confirm the password, select the user nature and click the registration button. If the registration is successful, a prompt “Registration success” will appear below the registration button.

Login function

Enter the user name and password on the login interface. The system searches for the account information in the database and selects the corresponding user interface (administrator system or user system) based on the user id.

Three, administrator system functions

  1. The functions of the administrator mainly include opening the camera, adding training sets (background pictures and garbage pictures to be trained), closing the camera, conducting model training, and presenting the model training results.
  2. The opening and closing of the camera is mainly controlled by registering a timer. The principle of image collection is generally 15~30 pictures from different angles for each garbage collection.
  3. The model training process adopts supervised learning, that is, the collected training set is labeled and the training is carried out. The obtained training model is saved in the TMP local folder and named after the current training time.
  4. The results of each round of training model are printed in the console, and the final training time is presented in the UI interface.

Iv. User system functions

  1. Text search: The user uses the input box to enter the garbage classification to be confirmed, click the search button, and the search result will be displayed in the result display area. If there is no search result, the user will be prompted to use the image to identify garbage classification.
  2. Image search: first, open the camera, click the select model button, upload the trained model, and click the Run detection button for image recognition of garbage classification. The result of image recognition is presented in the detection result area on the left (including detection result and confirmation).
  3. Voice broadcast: when text search results are presented, voice broadcast is available to present search results in the form of voice.

Project structures,

  • System: Windows 10
  • Compiler: VsCode
  • Hardware: Drive free USB camera
  • Environment: Python 3.7.0

I. Library used by the project

The library files Version
PyQt5 5.15.4
PySide2 5.15.2
opencv-python(cv2) 4.5.2.52
numpy 1.18.5
tensorflow 2.3.0
tensorflow_hub 0.12.0
keras 2.4.3
requests 2.25.1
urllib3 1.26.4

Ii. Project directory structure

The file name An effect or function.
dataset Data set (including training set and test set)
img Used to store project effect drawings
model Training basis model
style Store QSS files, several UI interface style files
tmp Store the completed model of the training
administrator.py Implementing the Administrator Interface
administrator.ui Use QT designers to get the administrator interface design document
projectMain.py The main entry to the project program
register.py Implement registration interface
register.ui Use the QT designer to get the registered interface design document
resident.db User account database
user.py Implementing the user interface
user.ui Use the USER interface design documents obtained by QT designers

Iii. Project construction

  1. Vscode editor is recommended. The configuration plug-ins include Qt for Python and SQLite. If the python environment is not available on your PC, refer to the installation procedure for Downloading and installing Anaconda – Building the Python Environment.
  2. For VScode to configure the Python environment: CTRL + Shift + P, click the Python selector, and select the appropriate Python environment. It is recommended to use Conda to build a new Python environment. For details, see: Create conda virtual environment to gracefully manage python environment.
  3. When the environment is configured, the next step is to run the project phase by running the project entry file projectmain.py. The following is the final effect of the project:

[Login interface]

[Registration interface]

[Administrator Interface]

【 User Interface 】

Four, notes

  1. Notice An external USB camera is required to run the project.
  2. At the same time, there is no training set in the project (you need to collect background pictures and garbage pictures according to your needs).
  3. There is no well-trained model in the project, so users need to train the model by themselves (register the administrator account and train the model in the administrator system interface).

Project Open Source address

  • Making address: github.com/zhang020801…
  • Demo video of the project: www.bilibili.com/video/BV1Vi…