mainwindow.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QMainWindow>
  4. #include <QString>
  5. #include <QLibrary>
  6. #include "inferthread.h"
  7. // Model initialization and destruction API
  8. typedef void (*InitModel)(const char*,
  9. const char*,
  10. const char*,
  11. const char*,
  12. bool , int , char* );
  13. typedef void (*DestructModel)();
  14. // Model reasoning API: det, seg, clas, mask
  15. typedef void (*Det_ModelPredict)(const unsigned char* ,
  16. int , int , int ,
  17. float* , int* , char* );
  18. typedef void (*Seg_ModelPredict)(const unsigned char* ,
  19. int , int , int ,
  20. unsigned char* );
  21. typedef void (*Cls_ModelPredict)(const unsigned char* ,
  22. int , int , int ,
  23. float* , char* , int* );
  24. typedef void (*Mask_ModelPredict)(const unsigned char* ,
  25. int , int , int ,
  26. float* , unsigned char* ,
  27. int* , char* );
  28. namespace Ui {
  29. class MainWindow;
  30. }
  31. class MainWindow : public QMainWindow
  32. {
  33. Q_OBJECT
  34. private: // Some logo or data storage variables
  35. bool has_Init; // Whether it is initialized
  36. bool doing_Infer; // Whether it is in reason
  37. QString model_Envs[2]; // Running environment collection
  38. QString model_Kinds[5]; // Model type collection
  39. bool is_paddlex; // Special record PADDLEX model
  40. bool is_mask; // Specially recorded Mask model under Paddlex
  41. QString model_Env; // Current operating environment
  42. int old_model_Env; // Last run environment
  43. QString model_Kind; // Current model type
  44. int old_model_Kind; // The last model type
  45. int gpu_Id; // Current GPU_ID
  46. int old_gpu_Id; // Last GPU_ID
  47. float det_threshold; // Target detection detection threshold
  48. float old_det_threshold; // The detection threshold of the last target detection
  49. int infer_Delay; // Continuous reasoning interval
  50. int old_infer_Delay; // The last continuous reasoning interval
  51. // Model file path
  52. QString model_path;
  53. QString param_path;
  54. QString config_path;
  55. // Inferential data path
  56. QString img_file;
  57. QStringList img_files;
  58. QString video_file;
  59. // Link pointer to a dynamic library
  60. QLibrary *inferLibrary;
  61. // Model initialization and destruction API
  62. InitModel initModel;
  63. DestructModel destructModel;
  64. // Model reasoning API
  65. Det_ModelPredict det_ModelPredict;
  66. Seg_ModelPredict seg_ModelPredict;
  67. Cls_ModelPredict cls_ModelPredict;
  68. Mask_ModelPredict mask_ModelPredict;
  69. private:
  70. InferThread *inferThread;
  71. public: // Some basic methods
  72. void Init_SystemState(); // Initialize state and data variables
  73. void Init_SystemShow(); // Initialize the state of the visual key: enable and disable
  74. public:
  75. explicit MainWindow(QWidget *parent = 0);
  76. ~MainWindow();
  77. private slots:
  78. void on_btnInit_clicked();
  79. void on_btnDistory_clicked();
  80. void on_btnLoadImg_clicked();
  81. void on_btnLoadImgs_clicked();
  82. void on_btnLoadVideo_clicked();
  83. void on_btnInfer_clicked();
  84. void on_btnStop_clicked();
  85. void on_cBoxEnv_currentIndexChanged(int index);
  86. void on_cBoxKind_currentIndexChanged(int index);
  87. void on_sBoxThreshold_valueChanged(double arg1);
  88. void on_lEditGpuId_textChanged(const QString &arg1);
  89. void on_sBoxDelay_valueChanged(const QString &arg1);
  90. private slots:
  91. void ImageUpdate(QImage* label1, QImage* label2);
  92. void Btn_StopAndInfer_StateUpdate(bool stop_state, bool infer_state);
  93. void CostTimeUpdate(double cost_time);
  94. private:
  95. Ui::MainWindow *ui;
  96. };
  97. #endif // MAINWINDOW_H