diff --git a/boot/main/src/header/Window.hpp b/boot/main/src/header/Window.hpp index be42a91c..9d6ccebe 100644 --- a/boot/main/src/header/Window.hpp +++ b/boot/main/src/header/Window.hpp @@ -153,10 +153,18 @@ class MainWindow : public LFRWindow { virtual ~MainWindow(); public: - // ImageGC + // 音频风格迁移 + void audioTs(); + // 图片内容生成 void imageGc(); - // ImageTS + // 图片风格迁移 void imageTs(); + // 视频内容生成 + void videoGc(); + // 视频风格迁移 + void videoTs(); + // 诗词内容生成 + void poetryGc(); // 关于 void about(); @@ -348,6 +356,19 @@ class AudioGCWindow : public ModelGCWindow { * @see AudioTS */ class AudioTSWindow : public ModelTSWindow { + +public: + /** + * @param width 窗口宽度 + * @param height 窗口高度 + * @param title 窗口名称 + */ + AudioTSWindow(int width, int height, const char* title = "音频风格迁移"); + virtual ~AudioTSWindow(); + +protected: + virtual void drawElement() override; + }; /** @@ -397,6 +418,18 @@ class PoetryGCWindow : public ModelGCWindow { // 自动标记:通过已有标记自动标记 Fl_Button* autoMarkPtr = nullptr; +public: + /** + * @param width 窗口宽度 + * @param height 窗口高度 + * @param title 窗口名称 + */ + PoetryGCWindow(int width, int height, const char* title = "诗词内容生成"); + virtual ~PoetryGCWindow(); + +protected: + virtual void drawElement() override; + }; /** @@ -411,12 +444,38 @@ class PoetryTSWindow : public ModelTSWindow { * @see VideoGC */ class VideoGCWindow : public ModelGCWindow { + +public: + /** + * @param width 窗口宽度 + * @param height 窗口高度 + * @param title 窗口名称 + */ + VideoGCWindow(int width, int height, const char* title = "视频内容生成"); + virtual ~VideoGCWindow(); + +protected: + virtual void drawElement() override; + }; /** * @see VideoTS */ class VideoTSWindow : public ModelTSWindow { + +public: + /** + * @param width 窗口宽度 + * @param height 窗口高度 + * @param title 窗口名称 + */ + VideoTSWindow(int width, int height, const char* title = "视频风格迁移"); + virtual ~VideoTSWindow(); + +protected: + virtual void drawElement() override; + }; /** diff --git a/boot/main/src/source/MainWindow.cpp b/boot/main/src/source/MainWindow.cpp index f51afceb..5b383cbf 100644 --- a/boot/main/src/source/MainWindow.cpp +++ b/boot/main/src/source/MainWindow.cpp @@ -97,14 +97,22 @@ void lifuren::MainWindow::drawElement() { this->aboutButtonPtr = new Fl_Button((this->w() - 80) / 4 * 3 + 60, this->h() - 40, (this->w() - 80) / 4, 30, "关于"); this->resizable(this); // 绑定事件 + LFR_BUTTON_CALLBACK_FUNCTION_BINDER(audioTsPtr, audioTs); LFR_BUTTON_CALLBACK_FUNCTION_BINDER(imageGcPtr, imageGc); LFR_BUTTON_CALLBACK_FUNCTION_BINDER(imageTsPtr, imageTs); + LFR_BUTTON_CALLBACK_FUNCTION_BINDER(videoGcPtr, videoGc); + LFR_BUTTON_CALLBACK_FUNCTION_BINDER(videoTsPtr, videoTs); + LFR_BUTTON_CALLBACK_FUNCTION_BINDER(poetryGcPtr, poetryGc); LFR_BUTTON_CALLBACK_FUNCTION_BINDER(aboutButtonPtr, about); this->reloadButtonPtr->callback(reload, this); } +LFR_BUTTON_CALLBACK_FUNCTION(audioTs, AudioTSWindow, audioTsWindowPtr, 1200, 800); LFR_BUTTON_CALLBACK_FUNCTION(imageGc, ImageGCWindow, imageGcWindowPtr, 1200, 800); LFR_BUTTON_CALLBACK_FUNCTION(imageTs, ImageTSWindow, imageTsWindowPtr, 1200, 800); +LFR_BUTTON_CALLBACK_FUNCTION(videoGc, VideoGCWindow, videoGcWindowPtr, 1200, 800); +LFR_BUTTON_CALLBACK_FUNCTION(videoTs, VideoTSWindow, videoTsWindowPtr, 1200, 800); +LFR_BUTTON_CALLBACK_FUNCTION(poetryGc, PoetryGCWindow, poetryGcWindowPtr, 1200, 800); LFR_BUTTON_CALLBACK_FUNCTION(about, AboutWindow, aboutWindowPtr, 512, 256); static void disable(Fl_Widget* widgetPtr, void* voidPtr) { diff --git a/boot/main/src/source/application/AudioGCWindow.cpp b/boot/main/src/source/application/AudioGCWindow.cpp index 7ed13530..a19f2444 100644 --- a/boot/main/src/source/application/AudioGCWindow.cpp +++ b/boot/main/src/source/application/AudioGCWindow.cpp @@ -1,5 +1 @@ -/** - * 图片内容生成 - * - * @author acgist - */ +#include "../../header/Window.hpp" diff --git a/boot/main/src/source/application/AudioTSWindow.cpp b/boot/main/src/source/application/AudioTSWindow.cpp index c89566ed..a7a0497f 100644 --- a/boot/main/src/source/application/AudioTSWindow.cpp +++ b/boot/main/src/source/application/AudioTSWindow.cpp @@ -1,5 +1,10 @@ -/** - * 图片风格迁移 - * - * @author acgist - */ \ No newline at end of file +#include "../../header/Window.hpp" + +lifuren::AudioTSWindow::AudioTSWindow(int width, int height, const char* title) : ModelTSWindow(width, height, title) { +} + +lifuren::AudioTSWindow::~AudioTSWindow() { +} + +void lifuren::AudioTSWindow::drawElement() { +} diff --git a/boot/main/src/source/application/PoetryGCWindow.cpp b/boot/main/src/source/application/PoetryGCWindow.cpp index e37f02a4..8586382b 100644 --- a/boot/main/src/source/application/PoetryGCWindow.cpp +++ b/boot/main/src/source/application/PoetryGCWindow.cpp @@ -1,5 +1,11 @@ -/** - * 诗词内容生成 - * - * @author acgist - */ \ No newline at end of file +#include "../../header/Window.hpp" + +lifuren::PoetryGCWindow::PoetryGCWindow(int width, int height, const char* title) : ModelGCWindow(width, height, title) { +} + +lifuren::PoetryGCWindow::~PoetryGCWindow() { + LFR_DELETE_THIS_PTR(autoMarkPtr); +} + +void lifuren::PoetryGCWindow::drawElement() { +} diff --git a/boot/main/src/source/application/PoetryTSWindow.cpp b/boot/main/src/source/application/PoetryTSWindow.cpp index 4aed9f0b..a19f2444 100644 --- a/boot/main/src/source/application/PoetryTSWindow.cpp +++ b/boot/main/src/source/application/PoetryTSWindow.cpp @@ -1,5 +1 @@ -/** - * 诗词风格迁移 - * - * @author acgist - */ \ No newline at end of file +#include "../../header/Window.hpp" diff --git a/boot/main/src/source/application/VideoGCWindow.cpp b/boot/main/src/source/application/VideoGCWindow.cpp index 49c2aee4..e0072a66 100644 --- a/boot/main/src/source/application/VideoGCWindow.cpp +++ b/boot/main/src/source/application/VideoGCWindow.cpp @@ -1,5 +1,10 @@ -/** - * 视频内容生成 - * - * @author acgist - */ \ No newline at end of file +#include "../../header/Window.hpp" + +lifuren::VideoGCWindow::VideoGCWindow(int width, int height, const char* title) : ModelGCWindow(width, height, title) { +} + +lifuren::VideoGCWindow::~VideoGCWindow() { +} + +void lifuren::VideoGCWindow::drawElement() { +} diff --git a/boot/main/src/source/application/VideoTSWindow.cpp b/boot/main/src/source/application/VideoTSWindow.cpp index 0f197c26..6be47740 100644 --- a/boot/main/src/source/application/VideoTSWindow.cpp +++ b/boot/main/src/source/application/VideoTSWindow.cpp @@ -1,5 +1,10 @@ -/** - * 视频风格迁移 - * - * @author acgist - */ \ No newline at end of file +#include "../../header/Window.hpp" + +lifuren::VideoTSWindow::VideoTSWindow(int width, int height, const char* title) : ModelTSWindow(width, height, title) { +} + +lifuren::VideoTSWindow::~VideoTSWindow() { +} + +void lifuren::VideoTSWindow::drawElement() { +} diff --git a/core/src/header/AudioGC.hpp b/core/src/header/AudioGC.hpp index b96f216e..8ab3f53f 100644 --- a/core/src/header/AudioGC.hpp +++ b/core/src/header/AudioGC.hpp @@ -2,48 +2,7 @@ * 音频内容生成 * * @author acgist + * + * @deprecated 不会实现 */ #pragma once - -#include "Model.hpp" - -namespace lifuren { - -/** - * 音频生成预测设置 - */ -class AudioGCPredictSetting : public lifuren::PredictSetting { -}; - -/** - * 音频生成训练设置 - */ -class AudioGCTrainingSetting : public lifuren::TrainingSetting { -}; - -/** - * 音频生成模型 - */ -class AudioGCModel : public LFRModel { - -public: - AudioGCModel(); - ~AudioGCModel(); - /** - * @param setting 基本配置 - */ - AudioGCModel(lifuren::Setting& setting); - -public: - /** - * @param setting 预测配置 - */ - void predict(lifuren::AudioGCPredictSetting& setting) override; - /** - * @param setting 训练配置 - */ - void training(lifuren::AudioGCTrainingSetting& setting) override; - -}; - -} diff --git a/core/src/header/Model.hpp b/core/src/header/Model.hpp index 53eda216..810e61b9 100644 --- a/core/src/header/Model.hpp +++ b/core/src/header/Model.hpp @@ -14,16 +14,14 @@ namespace lifuren { /** * 李夫人模型 * - * @param P 预测配置 - * @param T 训练配置 + * @param M 模型配置 * * @author acgist */ -template +template class LFRModel { -static_assert(std::is_base_of_v, "必须继承训练配置"); -static_assert(std::is_base_of_v, "必须继承预测配置"); +static_assert(std::is_base_of_v, "必须继承模型配置"); public: // 基本配置 @@ -35,7 +33,7 @@ static_assert(std::is_base_of_v, "必须继承预 /** * @param setting 基本配置 */ - LFRModel(lifuren::Setting& setting); + LFRModel(const lifuren::Setting& setting); public: /** @@ -47,17 +45,17 @@ static_assert(std::is_base_of_v, "必须继承预 */ virtual void load(); /** - * 模型预测 + * 训练模型 * - * @param 预测设置 + * @param setting 模型设置 */ - virtual void predict(P& setting) = 0; + virtual void train(const M& setting) = 0; /** - * 训练模型 + * 模型预测 * - * @param setting 训练设置 + * @param 模型设置 */ - virtual void training(T& setting) = 0; + virtual void predict(const M& setting) = 0; }; diff --git a/core/src/header/PoetryGC.hpp b/core/src/header/PoetryGC.hpp index 7ff8ca73..3dc0d503 100644 --- a/core/src/header/PoetryGC.hpp +++ b/core/src/header/PoetryGC.hpp @@ -5,4 +5,38 @@ */ #pragma once -#include "Model.hpp" \ No newline at end of file +#include "Model.hpp" + +namespace lifuren { + +/** + * 音频生成模型设置 + */ +class AudioGCModelSetting : public lifuren::ModelSetting { +}; + +/** + * 音频生成模型 + */ +class AudioGCModel : public LFRModel { + +public: + /** + * @param setting 基本配置 + */ + AudioGCModel(const lifuren::Setting& setting); + virtual ~AudioGCModel(); + +public: + /** + * @param setting 模型配置 + */ + void train(const lifuren::AudioGCModelSetting& setting) override; + /** + * @param setting 模型配置 + */ + void predict(const lifuren::AudioGCModelSetting& setting) override; + +}; + +} diff --git a/core/src/header/PoetryTS.hpp b/core/src/header/PoetryTS.hpp index 4f9f224a..ea498f47 100644 --- a/core/src/header/PoetryTS.hpp +++ b/core/src/header/PoetryTS.hpp @@ -2,7 +2,7 @@ * 诗词风格迁移 * * @author acgist + * + * @deprecated 不会实现 */ #pragma once - -#include "Model.hpp" diff --git a/core/src/header/Setting.hpp b/core/src/header/Setting.hpp index f1fdb2b3..90dd064a 100644 --- a/core/src/header/Setting.hpp +++ b/core/src/header/Setting.hpp @@ -86,15 +86,9 @@ class Setting { }; /** - * 预测设置 + * 模型设置 */ -class PredictSetting { -}; - -/** - * 训练设置 - */ -class TrainingSetting { +class ModelSetting { }; } diff --git a/core/src/source/Model.cpp b/core/src/source/Model.cpp index 831b9458..6d402c5d 100644 --- a/core/src/source/Model.cpp +++ b/core/src/source/Model.cpp @@ -1,21 +1,21 @@ #include "../header/Model.hpp" -template -lifuren::LFRModel::LFRModel() { +template +lifuren::LFRModel::LFRModel() { } -template -lifuren::LFRModel::~LFRModel() { +template +lifuren::LFRModel::~LFRModel() { } -template -lifuren::LFRModel::LFRModel(lifuren::Setting& setting) : setting(setting) { +template +lifuren::LFRModel::LFRModel(const lifuren::Setting& setting) : setting(setting) { } -template -void lifuren::LFRModel::save() { +template +void lifuren::LFRModel::save() { } -template -void lifuren::LFRModel::load() { +template +void lifuren::LFRModel::load() { } diff --git a/core/src/source/audio/AudioGC.cpp b/core/src/source/audio/AudioGC.cpp index a99984ed..b2560ab7 100644 --- a/core/src/source/audio/AudioGC.cpp +++ b/core/src/source/audio/AudioGC.cpp @@ -1,16 +1 @@ #include "../../header/AudioGC.hpp" - -lifuren::AudioGCModel::AudioGCModel() { -} - -lifuren::AudioGCModel::~AudioGCModel() { -} - -lifuren::AudioGCModel::AudioGCModel(lifuren::Setting& setting) : LFRModel(setting) { -} - -void lifuren::AudioGCModel::predict(lifuren::AudioGCPredictSetting& setting) { -} - -void lifuren::AudioGCModel::training(lifuren::AudioGCTrainingSetting& setting) { -} diff --git a/core/src/source/audio/AudioTS.cpp b/core/src/source/audio/AudioTS.cpp index e69de29b..0dd714f8 100644 --- a/core/src/source/audio/AudioTS.cpp +++ b/core/src/source/audio/AudioTS.cpp @@ -0,0 +1 @@ +#include "../../header/AudioTS.hpp" diff --git a/core/src/source/image/ImageGC.cpp b/core/src/source/image/ImageGC.cpp index e69de29b..fe89caf4 100644 --- a/core/src/source/image/ImageGC.cpp +++ b/core/src/source/image/ImageGC.cpp @@ -0,0 +1 @@ +#include "../../header/ImageGC.hpp" diff --git a/core/src/source/image/ImageTS.cpp b/core/src/source/image/ImageTS.cpp index e69de29b..7e797243 100644 --- a/core/src/source/image/ImageTS.cpp +++ b/core/src/source/image/ImageTS.cpp @@ -0,0 +1 @@ +#include "../../header/ImageTS.hpp" diff --git a/core/src/source/poetry/PoetryGC.cpp b/core/src/source/poetry/PoetryGC.cpp index e69de29b..ec254976 100644 --- a/core/src/source/poetry/PoetryGC.cpp +++ b/core/src/source/poetry/PoetryGC.cpp @@ -0,0 +1,13 @@ +#include "../../header/PoetryGC.hpp" + +lifuren::AudioGCModel::~AudioGCModel() { +} + +lifuren::AudioGCModel::AudioGCModel(const lifuren::Setting& setting) : LFRModel(setting) { +} + +void lifuren::AudioGCModel::train(const lifuren::AudioGCModelSetting& setting) { +} + +void lifuren::AudioGCModel::predict(const lifuren::AudioGCModelSetting& setting) { +} diff --git a/core/src/source/poetry/PoetryTS.cpp b/core/src/source/poetry/PoetryTS.cpp index e69de29b..2acff038 100644 --- a/core/src/source/poetry/PoetryTS.cpp +++ b/core/src/source/poetry/PoetryTS.cpp @@ -0,0 +1 @@ +#include "../../header/PoetryTS.hpp" diff --git a/core/src/source/video/VideoGC.cpp b/core/src/source/video/VideoGC.cpp index e69de29b..96d8d4c9 100644 --- a/core/src/source/video/VideoGC.cpp +++ b/core/src/source/video/VideoGC.cpp @@ -0,0 +1 @@ +#include "../../header/VideoGC.hpp" diff --git a/core/src/source/video/VideoTS.cpp b/core/src/source/video/VideoTS.cpp index e69de29b..8c7fcc67 100644 --- a/core/src/source/video/VideoTS.cpp +++ b/core/src/source/video/VideoTS.cpp @@ -0,0 +1 @@ +#include "../../header/VideoTS.hpp"