2016-07-03 13:37:26 +09:00
|
|
|
|
#pragma once
|
|
|
|
|
|
2016-07-03 15:36:32 +09:00
|
|
|
|
#include <string>
|
2016-07-03 13:37:26 +09:00
|
|
|
|
#include "waifu2x.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cNet
|
|
|
|
|
{
|
|
|
|
|
private:
|
2016-07-03 17:13:02 +09:00
|
|
|
|
Waifu2x::eWaifu2xModelType mMode;
|
|
|
|
|
|
2016-07-03 13:37:26 +09:00
|
|
|
|
boost::shared_ptr<caffe::Net<float>> mNet;
|
|
|
|
|
|
|
|
|
|
int mModelScale; // <20><><EFBFBD>f<EFBFBD><66><EFBFBD><EFBFBD><EFBFBD>ΏۂƂ<DB82><C682><EFBFBD><EFBFBD>g<EFBFBD>嗦
|
|
|
|
|
int mInnerScale; // <20>l<EFBFBD>b<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>Ŋg<C58A>傳<EFBFBD><E582B3><EFBFBD><EFBFBD><EFBFBD>{<7B><>
|
|
|
|
|
int mNetOffset; // <20>l<EFBFBD>b<EFBFBD>g<EFBFBD>ɓ<EFBFBD><C993>͂<EFBFBD><CD82><EFBFBD><EFBFBD>Ƃǂꂭ<C782>炢<EFBFBD><E782A2><EFBFBD><EFBFBD><EFBFBD>邩
|
|
|
|
|
int mInputPlane; // <20>l<EFBFBD>b<EFBFBD>g<EFBFBD>ւ̓<D682><CC93>̓`<60><><EFBFBD><EFBFBD><EFBFBD>l<EFBFBD><6C><EFBFBD><EFBFBD>
|
2016-07-03 17:13:02 +09:00
|
|
|
|
bool mHasNoiseScaleModel;
|
2016-07-03 13:37:26 +09:00
|
|
|
|
|
|
|
|
|
private:
|
2018-10-25 04:15:53 +09:00
|
|
|
|
void LoadParamFromInfo(const Waifu2x::eWaifu2xModelType mode, const Waifu2x::stInfo &info);
|
2016-07-03 13:37:26 +09:00
|
|
|
|
Waifu2x::eWaifu2xError LoadParameterFromJson(const boost::filesystem::path &model_path, const boost::filesystem::path ¶m_path
|
|
|
|
|
, const boost::filesystem::path &modelbin_path, const boost::filesystem::path &caffemodel_path, const std::string &process);
|
|
|
|
|
Waifu2x::eWaifu2xError SetParameter(caffe::NetParameter ¶m, const std::string &process) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
cNet();
|
|
|
|
|
~cNet();
|
|
|
|
|
|
2018-10-25 04:15:53 +09:00
|
|
|
|
static Waifu2x::eWaifu2xError GetInfo(const boost::filesystem::path &info_path, Waifu2x::stInfo &info);
|
2016-07-03 17:13:02 +09:00
|
|
|
|
|
2018-10-25 04:15:53 +09:00
|
|
|
|
Waifu2x::eWaifu2xError ConstractNet(const Waifu2x::eWaifu2xModelType mode, const boost::filesystem::path &model_path, const boost::filesystem::path ¶m_path, const Waifu2x::stInfo &info, const std::string &process);
|
2016-07-03 13:37:26 +09:00
|
|
|
|
|
|
|
|
|
int GetInputPlane() const;
|
|
|
|
|
int GetInnerScale() const;
|
|
|
|
|
int GetNetOffset() const;
|
|
|
|
|
int GetScale() const;
|
|
|
|
|
|
|
|
|
|
int GetInputMemorySize(const int crop_w, const int crop_h, const int outer_padding, const int batch_size) const;
|
|
|
|
|
int GetOutputMemorySize(const int crop_w, const int crop_h, const int outer_padding, const int batch_size) const;
|
|
|
|
|
|
2016-07-03 20:56:00 +09:00
|
|
|
|
Waifu2x::eWaifu2xError ReconstructImage(const bool UseTTA, const int crop_w, const int crop_h, const int outer_padding, const int batch_size, float *outputBlockBuf, const cv::Mat &inMat, cv::Mat &outMat);
|
2016-07-03 15:36:32 +09:00
|
|
|
|
|
|
|
|
|
static std::string GetModelName(const boost::filesystem::path &info_path);
|
2016-07-03 13:37:26 +09:00
|
|
|
|
};
|