diff --git a/WasteSorting.jpg b/WasteSorting.jpg
new file mode 100644
index 0000000..29efb86
Binary files /dev/null and b/WasteSorting.jpg differ
diff --git a/WasteSorting.pro b/WasteSorting.pro
new file mode 100644
index 0000000..523a079
--- /dev/null
+++ b/WasteSorting.pro
@@ -0,0 +1,37 @@
+QT += core gui multimedia multimediawidgets serialport network
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+ main.cpp \
+ widget.cpp
+
+HEADERS += \
+ widget.h
+
+FORMS += \
+ widget.ui
+
+TRANSLATIONS += \
+ WasteSorting_zh_CN.ts
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+RESOURCES += \
+ image.qrc
diff --git a/WasteSorting.pro.user b/WasteSorting.pro.user
new file mode 100644
index 0000000..6efded8
--- /dev/null
+++ b/WasteSorting.pro.user
@@ -0,0 +1,563 @@
+
+
+
+
+
+ EnvironmentId
+ {d7c6f6ed-3661-4448-b394-a20f7ac693ed}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ -fno-delayed-template-parsing
+
+ true
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.14.2 MSVC2017 64bit
+ Desktop Qt 5.14.2 MSVC2017 64bit
+ qt.qt5.5142.win64_msvc2017_64_kit
+ 1
+ 0
+ 0
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ C:/Users/14121/Desktop/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_64bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ WasteSorting2
+ Qt4ProjectManager.Qt4RunConfiguration:C:/Users/14121/Desktop/WasteSorting/WasteSorting.pro
+ C:/Users/14121/Desktop/WasteSorting/WasteSorting.pro
+
+ false
+
+ false
+ true
+ true
+ false
+ false
+ true
+
+ C:/Users/14121/Desktop/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_64bit-Release
+
+ 1
+
+
+
+ ProjectExplorer.Project.Target.1
+
+ Desktop Qt 5.14.2 MSVC2017 32bit
+ Desktop Qt 5.14.2 MSVC2017 32bit
+ qt.qt5.5142.win32_msvc2017_kit
+ 0
+ 0
+ 0
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_32bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_32bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_32bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+
+ ProjectExplorer.CustomExecutableRunConfiguration
+
+
+ false
+
+ false
+ true
+ false
+ false
+ true
+
+
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 2
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/WasteSorting.pro.user.1d87114.4.9-pre1 b/WasteSorting.pro.user.1d87114.4.9-pre1
new file mode 100644
index 0000000..f2a0e8b
--- /dev/null
+++ b/WasteSorting.pro.user.1d87114.4.9-pre1
@@ -0,0 +1,326 @@
+
+
+
+
+
+ EnvironmentId
+ {1d871142-4540-43ee-bc49-e59c0efe1a69}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ 桌面
+ 桌面
+ {ff17dd35-b21c-4987-9b8a-2fd992b8e5f7}
+ 1
+ 0
+ 0
+
+ /media/pi/刘臣轩/build-WasteSorting-unknown-Debug
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+ true
+
+
+ /home/pi/Desktop/Release/
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+
+ /media/pi/刘臣轩/build-WasteSorting-unknown-Profile
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+ 3
+
+
+ 0
+ 部署
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy Configuration
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ WasteSorting
+ WasteSorting2
+ Qt4ProjectManager.Qt4RunConfiguration:/home/pi/Desktop/WasteSorting/WasteSorting.pro
+ WasteSorting.pro
+
+ 3768
+ false
+ true
+ true
+ false
+ false
+ true
+
+ /home/pi/Desktop/Release
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 20
+
+
+ Version
+ 20
+
+
diff --git a/WasteSorting.pro.user.d7c6f6e.22 b/WasteSorting.pro.user.d7c6f6e.22
new file mode 100644
index 0000000..79d568e
--- /dev/null
+++ b/WasteSorting.pro.user.d7c6f6e.22
@@ -0,0 +1,563 @@
+
+
+
+
+
+ EnvironmentId
+ {d7c6f6ed-3661-4448-b394-a20f7ac693ed}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ -fno-delayed-template-parsing
+
+ true
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.14.2 MSVC2017 64bit
+ Desktop Qt 5.14.2 MSVC2017 64bit
+ qt.qt5.5142.win64_msvc2017_64_kit
+ 1
+ 0
+ 0
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_64bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ WasteSorting2
+ Qt4ProjectManager.Qt4RunConfiguration:C:/Users/14121/Desktop/WasteSorting/WasteSorting/WasteSorting.pro
+ C:/Users/14121/Desktop/WasteSorting/WasteSorting/WasteSorting.pro
+
+ false
+
+ false
+ true
+ true
+ false
+ false
+ true
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_64bit-Release
+
+ 1
+
+
+
+ ProjectExplorer.Project.Target.1
+
+ Desktop Qt 5.14.2 MSVC2017 32bit
+ Desktop Qt 5.14.2 MSVC2017 32bit
+ qt.qt5.5142.win32_msvc2017_kit
+ 0
+ 0
+ 0
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_32bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_32bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ C:/Users/14121/Desktop/WasteSorting/build-WasteSorting-Desktop_Qt_5_14_2_MSVC2017_32bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+
+ ProjectExplorer.CustomExecutableRunConfiguration
+
+
+ false
+
+ false
+ true
+ false
+ false
+ true
+
+
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 2
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/WasteSorting_zh_CN.ts b/WasteSorting_zh_CN.ts
new file mode 100644
index 0000000..562f2e5
--- /dev/null
+++ b/WasteSorting_zh_CN.ts
@@ -0,0 +1,3 @@
+
+
+
diff --git a/image.qrc b/image.qrc
new file mode 100644
index 0000000..944c6a9
--- /dev/null
+++ b/image.qrc
@@ -0,0 +1,17 @@
+
+
+ image/厨余垃圾.PNG
+ image/可回收物.PNG
+ image/其他垃圾.PNG
+ image/有害垃圾.PNG
+ image/中南大学.png
+ image/智能互联.png
+ image/识别中.png
+ image/满载警报.png
+ image/倾倒警报.png
+ image/logo1.png
+ image/主.png
+ image/工训大赛_.png
+ image/工训大赛.png
+
+
diff --git a/image/blue.jpg b/image/blue.jpg
new file mode 100644
index 0000000..2fd9294
Binary files /dev/null and b/image/blue.jpg differ
diff --git a/image/gray.png b/image/gray.png
new file mode 100644
index 0000000..233656c
Binary files /dev/null and b/image/gray.png differ
diff --git a/image/green.png b/image/green.png
new file mode 100644
index 0000000..5db6ece
Binary files /dev/null and b/image/green.png differ
diff --git a/image/lightblue.png b/image/lightblue.png
new file mode 100644
index 0000000..ee315be
Binary files /dev/null and b/image/lightblue.png differ
diff --git a/image/lightgray.png b/image/lightgray.png
new file mode 100644
index 0000000..02f09ab
Binary files /dev/null and b/image/lightgray.png differ
diff --git a/image/logo1.png b/image/logo1.png
new file mode 100644
index 0000000..3605a12
Binary files /dev/null and b/image/logo1.png differ
diff --git a/image/orange.png b/image/orange.png
new file mode 100644
index 0000000..9c0b00f
Binary files /dev/null and b/image/orange.png differ
diff --git a/image/red.png b/image/red.png
new file mode 100644
index 0000000..d374d39
Binary files /dev/null and b/image/red.png differ
diff --git a/image/中南大学.png b/image/中南大学.png
new file mode 100644
index 0000000..f3f75f8
Binary files /dev/null and b/image/中南大学.png differ
diff --git a/image/主.png b/image/主.png
new file mode 100644
index 0000000..9f6760c
Binary files /dev/null and b/image/主.png differ
diff --git a/image/倾倒警报.png b/image/倾倒警报.png
new file mode 100644
index 0000000..da9a184
Binary files /dev/null and b/image/倾倒警报.png differ
diff --git a/image/其他垃圾.PNG b/image/其他垃圾.PNG
new file mode 100644
index 0000000..613fb63
Binary files /dev/null and b/image/其他垃圾.PNG differ
diff --git a/image/厨余垃圾.PNG b/image/厨余垃圾.PNG
new file mode 100644
index 0000000..033b234
Binary files /dev/null and b/image/厨余垃圾.PNG differ
diff --git a/image/可回收物.PNG b/image/可回收物.PNG
new file mode 100644
index 0000000..d60da96
Binary files /dev/null and b/image/可回收物.PNG differ
diff --git a/image/工训大赛.png b/image/工训大赛.png
new file mode 100644
index 0000000..54012c9
Binary files /dev/null and b/image/工训大赛.png differ
diff --git a/image/工训大赛_.png b/image/工训大赛_.png
new file mode 100644
index 0000000..f9ae8a7
Binary files /dev/null and b/image/工训大赛_.png differ
diff --git a/image/智能互联.png b/image/智能互联.png
new file mode 100644
index 0000000..a5d608d
Binary files /dev/null and b/image/智能互联.png differ
diff --git a/image/有害垃圾.PNG b/image/有害垃圾.PNG
new file mode 100644
index 0000000..26345e6
Binary files /dev/null and b/image/有害垃圾.PNG differ
diff --git a/image/满载警报.png b/image/满载警报.png
new file mode 100644
index 0000000..33fcd00
Binary files /dev/null and b/image/满载警报.png differ
diff --git a/image/识别中.png b/image/识别中.png
new file mode 100644
index 0000000..0d8d378
Binary files /dev/null and b/image/识别中.png differ
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..3066d6e
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2021 刘臣轩
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "widget.h"
+
+#include
+
+int main(int argc, char* argv[])
+{
+ QApplication a(argc, argv);
+ Widget w;
+ w.setWindowFlag(Qt::FramelessWindowHint);
+ w.show();
+ return a.exec();
+}
diff --git a/msvc_make.bat b/msvc_make.bat
new file mode 100644
index 0000000..f6a0d3a
--- /dev/null
+++ b/msvc_make.bat
@@ -0,0 +1,2 @@
+chcp 65001
+"C:\Qt\Qt5.14.2\Tools\QtCreator\bin\jom.exe" %*
\ No newline at end of file
diff --git a/tensorflow/backup/1号电池-samples.zip b/tensorflow/backup/1号电池-samples.zip
new file mode 100644
index 0000000..14707d8
Binary files /dev/null and b/tensorflow/backup/1号电池-samples.zip differ
diff --git a/tensorflow/backup/5号电池-samples.zip b/tensorflow/backup/5号电池-samples.zip
new file mode 100644
index 0000000..1896b4f
Binary files /dev/null and b/tensorflow/backup/5号电池-samples.zip differ
diff --git a/tensorflow/backup/废纸团-samples.zip b/tensorflow/backup/废纸团-samples.zip
new file mode 100644
index 0000000..2d47a50
Binary files /dev/null and b/tensorflow/backup/废纸团-samples.zip differ
diff --git a/tensorflow/backup/易拉罐-samples.zip b/tensorflow/backup/易拉罐-samples.zip
new file mode 100644
index 0000000..21ca7fe
Binary files /dev/null and b/tensorflow/backup/易拉罐-samples.zip differ
diff --git a/tensorflow/backup/烟头-samples.zip b/tensorflow/backup/烟头-samples.zip
new file mode 100644
index 0000000..068d21e
Binary files /dev/null and b/tensorflow/backup/烟头-samples.zip differ
diff --git a/tensorflow/backup/矿泉水瓶-samples.zip b/tensorflow/backup/矿泉水瓶-samples.zip
new file mode 100644
index 0000000..60fe974
Binary files /dev/null and b/tensorflow/backup/矿泉水瓶-samples.zip differ
diff --git a/tensorflow/backup/碎瓷片-samples.zip b/tensorflow/backup/碎瓷片-samples.zip
new file mode 100644
index 0000000..651af51
Binary files /dev/null and b/tensorflow/backup/碎瓷片-samples.zip differ
diff --git a/tensorflow/backup/空-samples.zip b/tensorflow/backup/空-samples.zip
new file mode 100644
index 0000000..2c201b9
Binary files /dev/null and b/tensorflow/backup/空-samples.zip differ
diff --git a/tensorflow/label_image.py b/tensorflow/label_image.py
new file mode 100644
index 0000000..532073f
--- /dev/null
+++ b/tensorflow/label_image.py
@@ -0,0 +1,88 @@
+
+# Copyright(C) 2021 刘臣轩
+
+# This program is free software: you can redistribute it and / or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+
+#!/usr/bin/python
+# -*-coding:utf-8-*-
+
+from tflite_runtime.interpreter import Interpreter
+from PIL import Image
+import cv2
+import re
+import os
+import numpy as np
+
+
+def loadLabels(labelPath):
+ p = re.compile(r'\s*(\d+)(.+)')
+ with open(labelPath, 'r', encoding='utf-8') as labelFile:
+ lines = (p.match(line).groups() for line in labelFile.readlines())
+ return {int(num): text.strip() for num, text in lines}
+
+
+def load_labels(path):
+ with open(path, 'r', errors='ignore') as f:
+ return {i: line.strip() for i, line in enumerate(f.readlines())}
+
+
+def set_input_tensor(interpreter, image):
+ tensor_index = interpreter.get_input_details()[0]['index']
+ input_tensor = interpreter.tensor(tensor_index)()[0]
+ input_tensor[:, :] = image
+
+
+def classify_image(interpreter, image, top_k=1):
+ set_input_tensor(interpreter, image)
+ interpreter.invoke()
+ output_details = interpreter.get_output_details()[0]
+ output = np.squeeze(interpreter.get_tensor(output_details['index']))
+ # If the model is quantized (uint8 data), then dequantize the results
+ if output_details['dtype'] == np.uint8:
+ scale, zero_point = output_details['quantization']
+ output = scale * (output - zero_point)
+
+ ordered = np.argpartition(-output, top_k)
+ return [(i, output[i]) for i in ordered[:top_k]]
+
+
+def main():
+ # labels = load_labels('labels_mobilenet_quant_v1_224.txt')
+ # interpreter = Interpreter('mobilenet_v1_1.0_224_quant.tflite')
+ # labels = loadLabels('../WasteSorting/tensorflow/labels.txt')
+ interpreter = Interpreter('../WasteSorting/tensorflow/model.tflite')
+ interpreter.allocate_tensors()
+
+ pil_im = Image.open('../WasteSorting/WasteSorting.jpg').convert(
+ 'RGB').resize((224, 224), Image.ANTIALIAS)
+ pil_im.transpose(Image.FLIP_LEFT_RIGHT)
+
+ results = classify_image(interpreter, pil_im)
+ # print(results)
+ label = results[0][0]
+ if label == 0:
+ print('识别失败')
+ elif label in range(1, 4):
+ print('有害垃圾')
+ elif label in range(4, 7):
+ print('可回收物')
+ elif label in range(7, 10):
+ print('厨余垃圾')
+ else:
+ print('其他垃圾')
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tensorflow/labels.txt b/tensorflow/labels.txt
new file mode 100644
index 0000000..c239790
--- /dev/null
+++ b/tensorflow/labels.txt
@@ -0,0 +1,11 @@
+0 空
+1 1号电池
+2 2号电池
+3 5号电池
+4 易拉罐
+5 矿泉水瓶
+6 废纸团
+7 红苹果
+8 小片生菜
+9 碎瓷片
+10 烟头
diff --git a/tensorflow/labels_mobilenet_quant_v1_224.txt b/tensorflow/labels_mobilenet_quant_v1_224.txt
new file mode 100644
index 0000000..fe81123
--- /dev/null
+++ b/tensorflow/labels_mobilenet_quant_v1_224.txt
@@ -0,0 +1,1001 @@
+background
+tench
+goldfish
+great white shark
+tiger shark
+hammerhead
+electric ray
+stingray
+cock
+hen
+ostrich
+brambling
+goldfinch
+house finch
+junco
+indigo bunting
+robin
+bulbul
+jay
+magpie
+chickadee
+water ouzel
+kite
+bald eagle
+vulture
+great grey owl
+European fire salamander
+common newt
+eft
+spotted salamander
+axolotl
+bullfrog
+tree frog
+tailed frog
+loggerhead
+leatherback turtle
+mud turtle
+terrapin
+box turtle
+banded gecko
+common iguana
+American chameleon
+whiptail
+agama
+frilled lizard
+alligator lizard
+Gila monster
+green lizard
+African chameleon
+Komodo dragon
+African crocodile
+American alligator
+triceratops
+thunder snake
+ringneck snake
+hognose snake
+green snake
+king snake
+garter snake
+water snake
+vine snake
+night snake
+boa constrictor
+rock python
+Indian cobra
+green mamba
+sea snake
+horned viper
+diamondback
+sidewinder
+trilobite
+harvestman
+scorpion
+black and gold garden spider
+barn spider
+garden spider
+black widow
+tarantula
+wolf spider
+tick
+centipede
+black grouse
+ptarmigan
+ruffed grouse
+prairie chicken
+peacock
+quail
+partridge
+African grey
+macaw
+sulphur-crested cockatoo
+lorikeet
+coucal
+bee eater
+hornbill
+hummingbird
+jacamar
+toucan
+drake
+red-breasted merganser
+goose
+black swan
+tusker
+echidna
+platypus
+wallaby
+koala
+wombat
+jellyfish
+sea anemone
+brain coral
+flatworm
+nematode
+conch
+snail
+slug
+sea slug
+chiton
+chambered nautilus
+Dungeness crab
+rock crab
+fiddler crab
+king crab
+American lobster
+spiny lobster
+crayfish
+hermit crab
+isopod
+white stork
+black stork
+spoonbill
+flamingo
+little blue heron
+American egret
+bittern
+crane
+limpkin
+European gallinule
+American coot
+bustard
+ruddy turnstone
+red-backed sandpiper
+redshank
+dowitcher
+oystercatcher
+pelican
+king penguin
+albatross
+grey whale
+killer whale
+dugong
+sea lion
+Chihuahua
+Japanese spaniel
+Maltese dog
+Pekinese
+Shih-Tzu
+Blenheim spaniel
+papillon
+toy terrier
+Rhodesian ridgeback
+Afghan hound
+basset
+beagle
+bloodhound
+bluetick
+black-and-tan coonhound
+Walker hound
+English foxhound
+redbone
+borzoi
+Irish wolfhound
+Italian greyhound
+whippet
+Ibizan hound
+Norwegian elkhound
+otterhound
+Saluki
+Scottish deerhound
+Weimaraner
+Staffordshire bullterrier
+American Staffordshire terrier
+Bedlington terrier
+Border terrier
+Kerry blue terrier
+Irish terrier
+Norfolk terrier
+Norwich terrier
+Yorkshire terrier
+wire-haired fox terrier
+Lakeland terrier
+Sealyham terrier
+Airedale
+cairn
+Australian terrier
+Dandie Dinmont
+Boston bull
+miniature schnauzer
+giant schnauzer
+standard schnauzer
+Scotch terrier
+Tibetan terrier
+silky terrier
+soft-coated wheaten terrier
+West Highland white terrier
+Lhasa
+flat-coated retriever
+curly-coated retriever
+golden retriever
+Labrador retriever
+Chesapeake Bay retriever
+German short-haired pointer
+vizsla
+English setter
+Irish setter
+Gordon setter
+Brittany spaniel
+clumber
+English springer
+Welsh springer spaniel
+cocker spaniel
+Sussex spaniel
+Irish water spaniel
+kuvasz
+schipperke
+groenendael
+malinois
+briard
+kelpie
+komondor
+Old English sheepdog
+Shetland sheepdog
+collie
+Border collie
+Bouvier des Flandres
+Rottweiler
+German shepherd
+Doberman
+miniature pinscher
+Greater Swiss Mountain dog
+Bernese mountain dog
+Appenzeller
+EntleBucher
+boxer
+bull mastiff
+Tibetan mastiff
+French bulldog
+Great Dane
+Saint Bernard
+Eskimo dog
+malamute
+Siberian husky
+dalmatian
+affenpinscher
+basenji
+pug
+Leonberg
+Newfoundland
+Great Pyrenees
+Samoyed
+Pomeranian
+chow
+keeshond
+Brabancon griffon
+Pembroke
+Cardigan
+toy poodle
+miniature poodle
+standard poodle
+Mexican hairless
+timber wolf
+white wolf
+red wolf
+coyote
+dingo
+dhole
+African hunting dog
+hyena
+red fox
+kit fox
+Arctic fox
+grey fox
+tabby
+tiger cat
+Persian cat
+Siamese cat
+Egyptian cat
+cougar
+lynx
+leopard
+snow leopard
+jaguar
+lion
+tiger
+cheetah
+brown bear
+American black bear
+ice bear
+sloth bear
+mongoose
+meerkat
+tiger beetle
+ladybug
+ground beetle
+long-horned beetle
+leaf beetle
+dung beetle
+rhinoceros beetle
+weevil
+fly
+bee
+ant
+grasshopper
+cricket
+walking stick
+cockroach
+mantis
+cicada
+leafhopper
+lacewing
+dragonfly
+damselfly
+admiral
+ringlet
+monarch
+cabbage butterfly
+sulphur butterfly
+lycaenid
+starfish
+sea urchin
+sea cucumber
+wood rabbit
+hare
+Angora
+hamster
+porcupine
+fox squirrel
+marmot
+beaver
+guinea pig
+sorrel
+zebra
+hog
+wild boar
+warthog
+hippopotamus
+ox
+water buffalo
+bison
+ram
+bighorn
+ibex
+hartebeest
+impala
+gazelle
+Arabian camel
+llama
+weasel
+mink
+polecat
+black-footed ferret
+otter
+skunk
+badger
+armadillo
+three-toed sloth
+orangutan
+gorilla
+chimpanzee
+gibbon
+siamang
+guenon
+patas
+baboon
+macaque
+langur
+colobus
+proboscis monkey
+marmoset
+capuchin
+howler monkey
+titi
+spider monkey
+squirrel monkey
+Madagascar cat
+indri
+Indian elephant
+African elephant
+lesser panda
+giant panda
+barracouta
+eel
+coho
+rock beauty
+anemone fish
+sturgeon
+gar
+lionfish
+puffer
+abacus
+abaya
+academic gown
+accordion
+acoustic guitar
+aircraft carrier
+airliner
+airship
+altar
+ambulance
+amphibian
+analog clock
+apiary
+apron
+ashcan
+assault rifle
+backpack
+bakery
+balance beam
+balloon
+ballpoint
+Band Aid
+banjo
+bannister
+barbell
+barber chair
+barbershop
+barn
+barometer
+barrel
+barrow
+baseball
+basketball
+bassinet
+bassoon
+bathing cap
+bath towel
+bathtub
+beach wagon
+beacon
+beaker
+bearskin
+beer bottle
+beer glass
+bell cote
+bib
+bicycle-built-for-two
+bikini
+binder
+binoculars
+birdhouse
+boathouse
+bobsled
+bolo tie
+bonnet
+bookcase
+bookshop
+bottlecap
+bow
+bow tie
+brass
+brassiere
+breakwater
+breastplate
+broom
+bucket
+buckle
+bulletproof vest
+bullet train
+butcher shop
+cab
+caldron
+candle
+cannon
+canoe
+can opener
+cardigan
+car mirror
+carousel
+carpenter's kit
+carton
+car wheel
+cash machine
+cassette
+cassette player
+castle
+catamaran
+CD player
+cello
+cellular telephone
+chain
+chainlink fence
+chain mail
+chain saw
+chest
+chiffonier
+chime
+china cabinet
+Christmas stocking
+church
+cinema
+cleaver
+cliff dwelling
+cloak
+clog
+cocktail shaker
+coffee mug
+coffeepot
+coil
+combination lock
+computer keyboard
+confectionery
+container ship
+convertible
+corkscrew
+cornet
+cowboy boot
+cowboy hat
+cradle
+crane
+crash helmet
+crate
+crib
+Crock Pot
+croquet ball
+crutch
+cuirass
+dam
+desk
+desktop computer
+dial telephone
+diaper
+digital clock
+digital watch
+dining table
+dishrag
+dishwasher
+disk brake
+dock
+dogsled
+dome
+doormat
+drilling platform
+drum
+drumstick
+dumbbell
+Dutch oven
+electric fan
+electric guitar
+electric locomotive
+entertainment center
+envelope
+espresso maker
+face powder
+feather boa
+file
+fireboat
+fire engine
+fire screen
+flagpole
+flute
+folding chair
+football helmet
+forklift
+fountain
+fountain pen
+four-poster
+freight car
+French horn
+frying pan
+fur coat
+garbage truck
+gasmask
+gas pump
+goblet
+go-kart
+golf ball
+golfcart
+gondola
+gong
+gown
+grand piano
+greenhouse
+grille
+grocery store
+guillotine
+hair slide
+hair spray
+half track
+hammer
+hamper
+hand blower
+hand-held computer
+handkerchief
+hard disc
+harmonica
+harp
+harvester
+hatchet
+holster
+home theater
+honeycomb
+hook
+hoopskirt
+horizontal bar
+horse cart
+hourglass
+iPod
+iron
+jack-o'-lantern
+jean
+jeep
+jersey
+jigsaw puzzle
+jinrikisha
+joystick
+kimono
+knee pad
+knot
+lab coat
+ladle
+lampshade
+laptop
+lawn mower
+lens cap
+letter opener
+library
+lifeboat
+lighter
+limousine
+liner
+lipstick
+Loafer
+lotion
+loudspeaker
+loupe
+lumbermill
+magnetic compass
+mailbag
+mailbox
+maillot
+maillot
+manhole cover
+maraca
+marimba
+mask
+matchstick
+maypole
+maze
+measuring cup
+medicine chest
+megalith
+microphone
+microwave
+military uniform
+milk can
+minibus
+miniskirt
+minivan
+missile
+mitten
+mixing bowl
+mobile home
+Model T
+modem
+monastery
+monitor
+moped
+mortar
+mortarboard
+mosque
+mosquito net
+motor scooter
+mountain bike
+mountain tent
+mouse
+mousetrap
+moving van
+muzzle
+nail
+neck brace
+necklace
+nipple
+notebook
+obelisk
+oboe
+ocarina
+odometer
+oil filter
+organ
+oscilloscope
+overskirt
+oxcart
+oxygen mask
+packet
+paddle
+paddlewheel
+padlock
+paintbrush
+pajama
+palace
+panpipe
+paper towel
+parachute
+parallel bars
+park bench
+parking meter
+passenger car
+patio
+pay-phone
+pedestal
+pencil box
+pencil sharpener
+perfume
+Petri dish
+photocopier
+pick
+pickelhaube
+picket fence
+pickup
+pier
+piggy bank
+pill bottle
+pillow
+ping-pong ball
+pinwheel
+pirate
+pitcher
+plane
+planetarium
+plastic bag
+plate rack
+plow
+plunger
+Polaroid camera
+pole
+police van
+poncho
+pool table
+pop bottle
+pot
+potter's wheel
+power drill
+prayer rug
+printer
+prison
+projectile
+projector
+puck
+punching bag
+purse
+quill
+quilt
+racer
+racket
+radiator
+radio
+radio telescope
+rain barrel
+recreational vehicle
+reel
+reflex camera
+refrigerator
+remote control
+restaurant
+revolver
+rifle
+rocking chair
+rotisserie
+rubber eraser
+rugby ball
+rule
+running shoe
+safe
+safety pin
+saltshaker
+sandal
+sarong
+sax
+scabbard
+scale
+school bus
+schooner
+scoreboard
+screen
+screw
+screwdriver
+seat belt
+sewing machine
+shield
+shoe shop
+shoji
+shopping basket
+shopping cart
+shovel
+shower cap
+shower curtain
+ski
+ski mask
+sleeping bag
+slide rule
+sliding door
+slot
+snorkel
+snowmobile
+snowplow
+soap dispenser
+soccer ball
+sock
+solar dish
+sombrero
+soup bowl
+space bar
+space heater
+space shuttle
+spatula
+speedboat
+spider web
+spindle
+sports car
+spotlight
+stage
+steam locomotive
+steel arch bridge
+steel drum
+stethoscope
+stole
+stone wall
+stopwatch
+stove
+strainer
+streetcar
+stretcher
+studio couch
+stupa
+submarine
+suit
+sundial
+sunglass
+sunglasses
+sunscreen
+suspension bridge
+swab
+sweatshirt
+swimming trunks
+swing
+switch
+syringe
+table lamp
+tank
+tape player
+teapot
+teddy
+television
+tennis ball
+thatch
+theater curtain
+thimble
+thresher
+throne
+tile roof
+toaster
+tobacco shop
+toilet seat
+torch
+totem pole
+tow truck
+toyshop
+tractor
+trailer truck
+tray
+trench coat
+tricycle
+trimaran
+tripod
+triumphal arch
+trolleybus
+trombone
+tub
+turnstile
+typewriter keyboard
+umbrella
+unicycle
+upright
+vacuum
+vase
+vault
+velvet
+vending machine
+vestment
+viaduct
+violin
+volleyball
+waffle iron
+wall clock
+wallet
+wardrobe
+warplane
+washbasin
+washer
+water bottle
+water jug
+water tower
+whiskey jug
+whistle
+wig
+window screen
+window shade
+Windsor tie
+wine bottle
+wing
+wok
+wooden spoon
+wool
+worm fence
+wreck
+yawl
+yurt
+web site
+comic book
+crossword puzzle
+street sign
+traffic light
+book jacket
+menu
+plate
+guacamole
+consomme
+hot pot
+trifle
+ice cream
+ice lolly
+French loaf
+bagel
+pretzel
+cheeseburger
+hotdog
+mashed potato
+head cabbage
+broccoli
+cauliflower
+zucchini
+spaghetti squash
+acorn squash
+butternut squash
+cucumber
+artichoke
+bell pepper
+cardoon
+mushroom
+Granny Smith
+strawberry
+orange
+lemon
+fig
+pineapple
+banana
+jackfruit
+custard apple
+pomegranate
+hay
+carbonara
+chocolate sauce
+dough
+meat loaf
+pizza
+potpie
+burrito
+red wine
+espresso
+cup
+eggnog
+alp
+bubble
+cliff
+coral reef
+geyser
+lakeside
+promontory
+sandbar
+seashore
+valley
+volcano
+ballplayer
+groom
+scuba diver
+rapeseed
+daisy
+yellow lady's slipper
+corn
+acorn
+hip
+buckeye
+coral fungus
+agaric
+gyromitra
+stinkhorn
+earthstar
+hen-of-the-woods
+bolete
+ear
+toilet tissue
diff --git a/tensorflow/mobilenet_v1_1.0_224_quant.tflite b/tensorflow/mobilenet_v1_1.0_224_quant.tflite
new file mode 100644
index 0000000..437640b
Binary files /dev/null and b/tensorflow/mobilenet_v1_1.0_224_quant.tflite differ
diff --git a/tensorflow/model.tflite b/tensorflow/model.tflite
new file mode 100644
index 0000000..c1e1366
Binary files /dev/null and b/tensorflow/model.tflite differ
diff --git a/tensorflow/project.tm b/tensorflow/project.tm
new file mode 100644
index 0000000..ee7cbba
Binary files /dev/null and b/tensorflow/project.tm differ
diff --git a/test.mp4 b/test.mp4
new file mode 100644
index 0000000..6fbe7fb
Binary files /dev/null and b/test.mp4 differ
diff --git a/widget.cpp b/widget.cpp
new file mode 100644
index 0000000..cc92de3
--- /dev/null
+++ b/widget.cpp
@@ -0,0 +1,348 @@
+/*
+ * Copyright (C) 2021 刘臣轩
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "widget.h"
+#include "ui_widget.h"
+
+Widget::Widget(QWidget* parent)
+ : QWidget(parent)
+ , ui(new Ui::Widget)
+{
+ ui->setupUi(this);
+ connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(close()));
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/主.png);}");
+ ui->textEdit->append("开始初始化设备");
+
+ // Time
+ QTimer* timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(timerUpdate()));
+ timer->start(500);
+
+ initSerial();
+#ifdef Q_OS_WIN
+ initCamera();
+#else
+ connect(this, SIGNAL(imageCaptured(int, QImage)), this, SLOT(onImageCaptured(int, QImage)));
+ ui->textEdit->append("摄像头初始化成功");
+#endif
+
+ // Network
+ networkManager = new QNetworkAccessManager();
+ networkRequest = new QNetworkRequest();
+ networkRequest->setHeader(QNetworkRequest::ContentTypeHeader, " application/json;charset=UTF-8");
+ url = new QUrl("https://aiapi.jd.com/jdai/garbageImageSearch");
+ connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onRequestFinished(QNetworkReply*)));
+
+ ui->label_3->setText("工训大赛");
+ ui->label_4->setStyleSheet("border-image: url(:/new/prefix1/image/工训大赛.png);\nborder-radius: 10px;\n");
+ ui->label_4->setVisible(true);
+ ui->label_5->setVisible(false);
+ ui->textEdit->append("设备初始化成功√");
+ number = 0;
+
+ // Video
+ player = new QMediaPlayer;
+ videoWidget = new QVideoWidget(this);
+ playList = new QMediaPlaylist;
+#ifdef Q_OS_WIN
+ playList->addMedia(QUrl::fromLocalFile("../WasteSorting/test.mp4"));
+#else
+ playList->addMedia(QUrl::fromLocalFile("/home/pi/Desktop/WasteSorting/test.mp4"));
+#endif
+ playList->setPlaybackMode(QMediaPlaylist::CurrentItemInLoop);
+ player->setPlaylist(playList);
+ player->setVideoOutput(videoWidget);
+ ui->verticalLayout->addWidget(videoWidget);
+ videoWidget->setVisible(false);
+
+ videoTimer = new QTimer(this);
+ connect(videoTimer, SIGNAL(timeout()), this, SLOT(videoTimerUpdate()));
+ videoTimer->setSingleShot(true);
+ videoTimer->start(10000);
+}
+
+Widget::~Widget()
+{
+ delete ui;
+}
+
+void Widget::timerUpdate()
+{
+ QString str = QDateTime::currentDateTime().toString("yyyy年MM月dd日 hh:mm:ss");
+ ui->label->setText(str);
+}
+
+void Widget::videoTimerUpdate()
+{
+ ui->label_4->setVisible(false);
+ player->play();
+ videoWidget->setVisible(true);
+ ui->label_3->setText("播放视频");
+ ui->textEdit->append("播放视频");
+}
+
+void Widget::initSerial()
+{
+ ui->textEdit->append("开始初始化串口");
+ serialPort = new QSerialPort();
+ connect(serialPort, SIGNAL(readyRead()), this, SLOT(serialRead()));
+ if (QSerialPortInfo::availablePorts().length() == 0) {
+ QMessageBox::critical(this, "错误", "无可用串口设备,请检查硬件连接后重试");
+ exit(0);
+ }
+#ifdef Q_OS_WIN
+ QString portName = QSerialPortInfo::availablePorts()[1].portName();
+ qDebug() << portName;
+ ui->textEdit->append("尝试连接串口" + portName);
+ serialPort->setPortName(portName);
+#else
+ QString portName = "ttyUSB0";
+ ui->textEdit->append("尝试连接串口ttyUSB0");
+ serialPort->setPortName("ttyUSB0");
+#endif
+ if (serialPort->open(QIODevice::ReadWrite)) {
+ ui->textEdit->append("串口连接成功");
+ serialPort->setBaudRate(115200);
+ serialPort->setDataBits(QSerialPort::Data8);
+ serialPort->setParity(QSerialPort::NoParity);
+ serialPort->setStopBits(QSerialPort::OneStop);
+ } else {
+ QMessageBox::critical(this, "错误", "串口设备" + portName + "无法打开,请检查硬件连接后重试");
+ exit(0);
+ }
+ ui->textEdit->append("串口初始化成功");
+}
+
+void Widget::initCamera()
+{
+ // for (QCameraInfo& info : QCameraInfo::availableCameras()) {
+ // qDebug() << info.deviceName();
+ // }
+ int camNum = QCameraInfo::availableCameras().length();
+ if (!camNum) {
+ QMessageBox::critical(this, "错误", "无可用摄像头,请检查硬件连接后重试");
+ exit(0);
+ }
+ ui->textEdit->append("开始初始化摄像头");
+ camera = new QCamera(QCameraInfo::availableCameras()[0], this);
+ imageCapture = new QCameraImageCapture(camera);
+ connect(imageCapture, SIGNAL(imageCaptured(int, QImage)), this, SLOT(onImageCaptured(int, QImage)));
+ camera->setCaptureMode(QCamera::CaptureStillImage);
+ imageCapture->setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
+ camera->start();
+ ui->textEdit->append("摄像头初始化成功");
+}
+
+void Widget::serialRead()
+{
+ QByteArray buffer = serialPort->readAll();
+ // qDebug() << buffer;
+ if (buffer[0] == '\x03' && buffer[1] == '\xFC'
+ && buffer[3] == '\xFC' && buffer[4] == '\x03') {
+ switch (buffer[2]) {
+ case '\x00':
+ ui->textEdit->append("取消警报");
+ ui->label_3->setText("取消警报");
+ ui->label_4->setVisible(true);
+ ui->label_5->setVisible(false);
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/主.png);}");
+ videoTimer->start(10000);
+ break;
+ case '\x01':
+ ui->textEdit->append("触发拍照信号");
+ ui->label_3->setText("触发拍照");
+ videoTimer->stop();
+ videoWidget->setVisible(false);
+ player->stop();
+#ifdef Q_OS_WIN
+ imageCapture->capture();
+#else
+ captureImage();
+#endif
+ break;
+ case '\x02':
+ ui->textEdit->append("投递完毕");
+ ui->label_3->setText("投递完毕");
+ ui->label_4->setVisible(true);
+ ui->label_5->setVisible(false);
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/主.png);}");
+ videoTimer->start(10000);
+ break;
+ case '\x04':
+ ui->textEdit->append("满载警报");
+ ui->label_3->setText("满载警报");
+ ui->label_4->setVisible(false);
+ videoTimer->stop();
+ videoWidget->setVisible(false);
+ player->stop();
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/满载警报.png);}");
+ break;
+ case '\x08':
+ // qDebug() << "倾倒警报";
+ ui->textEdit->append("倾倒警报");
+ ui->label_3->setText("倾倒警报");
+ ui->label_4->setVisible(false);
+ videoTimer->stop();
+ videoWidget->setVisible(false);
+ player->stop();
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/倾倒警报.png);}");
+ break;
+ case '\xFF':
+ break;
+ }
+ }
+}
+
+void Widget::serialWrite(const char data)
+{
+ QByteArray buffer("\x30\xCF\x0F\xCF\x30");
+ buffer[2] = data;
+ serialPort->write(buffer);
+}
+
+void Widget::captureImage()
+{
+ system("raspistill -o ../WasteSorting/WasteSorting.jpg -t 1 -br 70 -hf -awb sun");
+ QImage image("../WasteSorting/WasteSorting.jpg");
+ emit(imageCaptured(0, image));
+}
+
+void Widget::onImageCaptured(int, QImage image)
+{
+ // 显示图片
+ ui->label_4->setVisible(false);
+ ui->label_5->setPixmap(QPixmap::fromImage(image).scaled(405, 306));
+ ui->label_5->setVisible(true);
+ ui->label_3->setText("识别中");
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/识别中.png);}");
+
+ /* 使用京东垃圾识别 API
+ // Base64编码
+ QByteArray ba;
+ QBuffer buf(&ba);
+ image.save(&buf, "JPG", -1);
+ QByteArray imageBase64 = ba.toBase64();
+ // qDebug() << "data:image/jpg;base64," + imageBase64;
+
+ // Request
+ sendRequest(imageBase64);
+ */
+
+ /* 使用TensorFlow Lite */
+#ifdef Q_OS_WIN
+ image.save("../WasteSorting/WasteSorting.jpg");
+ FILE* fp = _popen("python ../WasteSorting/tensorflow/label_image.py", "rt");
+ char buf[255] = { 0 };
+ fscanf(fp, "%s", buf);
+ _pclose(fp);
+#else
+ FILE* fp = popen("python3 ../WasteSorting/tensorflow/label_image.py", "r");
+ char buf[255] = { 0 };
+ printf("%s", buf);
+ fscanf(fp, "%s", buf);
+ pclose(fp);
+#endif
+ QString cate_name = QString::fromLocal8Bit(buf);
+ qDebug() << cate_name;
+ classifyFinished(cate_name);
+}
+
+void Widget::sendRequest(QByteArray& imageBase64)
+{
+ QUrlQuery query;
+ query.addQueryItem("appkey", "3a24b33468565b633d25d426eb0c660c");
+ qint64 timestamp = QDateTime::currentDateTime().toMSecsSinceEpoch();
+ query.addQueryItem("timestamp", QString::number(timestamp));
+ QString sign = "58125e5985e6ef2d385ebfaa646987ba" + QString::number(timestamp);
+ QByteArray ba = QCryptographicHash::hash(sign.toUtf8(), QCryptographicHash::Md5);
+ query.addQueryItem("sign", ba.toHex());
+ url->setQuery(query);
+ networkRequest->setUrl(*url);
+ // qDebug() << query.toString();
+
+ QJsonObject json;
+ json.insert("imgBase64", QString(imageBase64));
+ json.insert("cityId", "440300");
+ QJsonDocument document;
+ document.setObject(json);
+ QByteArray data = document.toJson(QJsonDocument::Compact);
+ // qDebug() << QString(data);
+
+ networkManager->post(*networkRequest, data);
+}
+
+void Widget::onRequestFinished(QNetworkReply* reply)
+{
+ QVariant statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
+ if (!statusCode.isValid()) {
+ QMessageBox::critical(this, "错误", "网络连接不可用,请检查后重试");
+ exit(0);
+ }
+ QByteArray replyData = reply->readAll();
+ QJsonParseError jsonError;
+ QJsonDocument document = QJsonDocument::fromJson(replyData, &jsonError);
+ if (!document.isNull() && (jsonError.error == QJsonParseError::NoError)) {
+ QJsonObject object = document.object().value("result").toObject();
+ QJsonArray array = object.value("garbage_info").toArray();
+ QJsonObject max = std::max_element(array.begin(), array.end(),
+ [](QJsonValue const& a, QJsonValue const& b) { return a.toObject().value("confidence").toDouble()
+ < b.toObject().value("confidence").toDouble(); })
+ ->toObject();
+ QString cate_name = max.value("cate_name").toString();
+ QString garbage_name = max.value("garbage_name").toString();
+ double confidence = max.value("confidence").toDouble();
+ // qDebug() << "cate_name:" << cate_name;
+ // qDebug() << "garbage_name:" << garbage_name;
+ // qDebug() << "confidence:" << confidence;
+ // ui->textEdit->append("cate_name: " + cate_name);
+ // ui->textEdit->append("garbage_name: " + garbage_name);
+ // ui->textEdit->append("confidence: " + QString::number(confidence));
+ classifyFinished(cate_name);
+
+ } else {
+ serialWrite('\xFF');
+ ui->textEdit->append("识别失败,请重试");
+ ui->label_3->setText("识别失败");
+ ui->label_4->setVisible(true);
+ ui->label_5->setVisible(false);
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/主.png);}");
+ }
+}
+
+void Widget::classifyFinished(QString cate_name)
+{
+ number += 1;
+ ui->textEdit->append(QString::number(number) + " " + cate_name + " 1 OK!");
+
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/" + cate_name + ".PNG);}");
+ ui->label_3->setText("投递中");
+ if (cate_name == "识别失败") {
+ serialWrite('\xFF');
+ ui->textEdit->append("识别失败,请重试");
+ ui->label_3->setText("识别失败");
+ ui->label_4->setVisible(true);
+ ui->label_5->setVisible(false);
+ ui->frame->setStyleSheet("#frame {border-image: url(:/new/prefix1/image/主.png);}");
+ } else if (cate_name == "可回收物")
+ serialWrite('\x01');
+ else if (cate_name == "厨余垃圾")
+ serialWrite('\x02');
+ else if (cate_name == "有害垃圾")
+ serialWrite('\x04');
+ else
+ serialWrite('\x08');
+}
diff --git a/widget.h b/widget.h
new file mode 100644
index 0000000..80e83f3
--- /dev/null
+++ b/widget.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2021 刘臣轩
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#if _MSC_VER >= 1600
+#pragma execution_character_set("utf-8")
+#endif
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+class Widget;
+}
+QT_END_NAMESPACE
+
+class Widget : public QWidget {
+ Q_OBJECT
+
+public:
+ Widget(QWidget* parent = nullptr);
+ ~Widget();
+
+private:
+ Ui::Widget* ui;
+
+ QTimer* videoTimer;
+ QMediaPlayer* player;
+ QVideoWidget* videoWidget;
+ QMediaPlaylist* playList;
+
+ QSerialPort* serialPort;
+ void initSerial();
+ void serialWrite(const char data);
+
+ QCamera* camera;
+ QCameraViewfinder* viewFinder;
+ QCameraImageCapture* imageCapture;
+ void initCamera();
+ void captureImage();
+
+ QNetworkAccessManager* networkManager;
+ QNetworkRequest* networkRequest;
+ QUrl* url;
+ void sendRequest(QByteArray& imageBase64);
+ void classifyFinished(QString cate_name);
+
+ qint64 number;
+
+private slots:
+ void timerUpdate();
+ void videoTimerUpdate();
+ void serialRead();
+ void onImageCaptured(int, QImage image);
+ void onRequestFinished(QNetworkReply* reply);
+
+signals:
+ void imageCaptured(int, QImage);
+};
+
+#endif // WIDGET_H
diff --git a/widget.ui b/widget.ui
new file mode 100644
index 0000000..a144ce5
--- /dev/null
+++ b/widget.ui
@@ -0,0 +1,330 @@
+
+
+ Widget
+
+
+ Qt::NonModal
+
+
+ true
+
+
+
+ 0
+ 0
+ 1024
+ 600
+
+
+
+ Qt::DefaultContextMenu
+
+
+ Widget
+
+
+
+
+
+
+
+ 50
+ 30
+ 95
+ 95
+
+
+
+
+ 0
+ 0
+
+
+
+ Qt::DefaultContextMenu
+
+
+ false
+
+
+ false
+
+
+
+
+
+
+ :/new/prefix1/image/中南大学.png:/new/prefix1/image/中南大学.png
+
+
+
+ 95
+ 95
+
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ true
+
+
+
+
+ true
+
+
+
+ 0
+ 0
+ 1024
+ 600
+
+
+
+ #frame {border-image: url(:/new/prefix1/image/主.png);}
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+
+
+ 160
+ 55
+ 601
+ 51
+
+
+
+
+ 0
+ 0
+
+
+
+
+ Microsoft JhengHei UI Light
+ 31
+ 50
+ false
+ false
+ false
+ true
+
+
+
+ false
+
+
+ color: rgb(255, 255, 255);
+
+
+ QFrame::NoFrame
+
+
+ 2020年11月03日 10:52:04
+
+
+ true
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ false
+
+
+ Qt::NoTextInteraction
+
+
+
+
+
+ 790
+ 50
+ 201
+ 51
+
+
+
+
+ Microsoft YaHei UI
+ 30
+
+
+
+ color: rgb(255, 255, 255);
+
+
+ 初始化中
+
+
+
+
+
+ 770
+ 150
+ 301
+ 401
+
+
+
+
+ 方正粗黑宋简体
+ 11
+ 50
+ false
+ false
+ PreferDefault
+
+
+
+ border-radius: 10px;
+color: rgb(255, 255, 255);
+background-color: black;
+background-color: rgba(0, 0, 0, 128);
+font: 11pt "方正粗黑宋简体";
+
+
+
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ true
+
+
+ 15
+
+
+
+
+ true
+
+
+
+ 46
+ 151
+ 692
+ 400
+
+
+
+
+
+
+
+
+
+
+
+
+ 300
+ 199
+ 405
+ 306
+
+
+
+ background-color: rgb(255, 0, 0);
+
+
+
+
+
+
+
+
+ 774
+ 153
+ 248
+ 394
+
+
+
+
+ 微软雅黑
+ 12
+
+
+
+ false
+
+
+ border-radius: 10px;
+color: rgb(255, 255, 255);
+background-color: rgba(0, 0, 0, 0);
+
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ true
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'微软雅黑'; font-size:12pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;"><br /></p></body></html>
+
+
+ Qt::NoTextInteraction
+
+
+
+
+
+ 40
+ 150
+ 701
+ 401
+
+
+
+
+ 0
+
+
+ QLayout::SetNoConstraint
+
+
+ 0
+
+
+ 0
+
+
+
+ frame
+ pushButton
+ label
+ label_3
+ label_2
+ label_5
+ label_4
+ textEdit
+ verticalLayoutWidget
+
+
+
+
+
+