智能合约互助游戏系统开发(FDF互助游戏开发)丨FDF互助游戏系统源码案例
什么是Web 3.0技术?
1.分布式计算
Web 3.0技术可以利用分布式计算在去中心化网络上实现大规模协作和计算。这可用于各种应用,例如科学研究、机器学习和游戏。
2.加密货币
加密货币是可以用作交换媒介、价值存储或记账单位的数字资产。它们基于区块链,可用于在不需要中间人的情况下使交易安全高效。
3.智能合约
智能合约是在区块链上编码的自动执行合约。它们可以自动执行各方之间的协议,从而可以为供应链管理、房地产和保险等各种应用程序创建更高效、更透明的系统。
4.Web 3.0浏览器
Web 3.0浏览器是专门用于分散式应用程序和区块链网络的浏览器。它们使访问社交网络、游戏应用程序和去中心化金融(DeFi)平台等Web 3.0技术并与之交互变得容易。
Calibration::Calibration(MNN::NetT*model,const uint8_t*modelBuffer,const int bufferSize,const std::string&configPath)
:_originaleModel(model){
//when the format of input image is RGB/BGR,channels equal to 3,GRAY is 1
int channles=3;
//解析量化json配置文件
rapidjson::Document document;
{
std::ifstream fileNames(configPath.c_str());
std::ostringstream output;
output<<fileNames.rdbuf();
auto outputStr=output.str();
document.Parse(outputStr.c_str());
if(document.HasParseError()){
MNN_ERROR("Invalid jsonn");
return;开发流程及需求I59原理2OO7开发3O69
}
}
auto picObj=document.GetObject();
ImageProcess::Config config;
config.filterType=BILINEAR;
config.destFormat=BGR;
{
if(picObj.HasMember("format")){
auto format=picObj["format"].GetString();
static std::map<std::string,ImageFormat>formatMap{{"BGR",BGR},{"RGB",RGB},{"GRAY",GRAY},{"RGBA",RGBA},{"BGRA",BGRA}};
if(formatMap.find(format)!=formatMap.end()){
config.destFormat=formatMap.find(format)->second;
}
}
}需求及方案:MrsFu123
switch(config.destFormat){
case GRAY:
channles=1;
break;
case RGB:
case BGR:
channles=3;
break;
case RGBA:
case BGRA:
channles=4;
break;
default:
break;
}
if(picObj.HasMember("weight_quantize_method")){
std::string method=picObj["weight_quantize_method"].GetString();
if(Helper::weightQuantizeMethod.find(method)!=Helper::weightQuantizeMethod.end()){
_weightQuantizeMethod=method;
}else{
MNN_ERROR("not supported weight quantization method:%sn",method.c_str());
return;
}
}
DLOG(INFO)<<"Use feature quantization method:"<<_featureQuantizeMethod;
DLOG(INFO)<<"Use weight quantization method:"<<_weightQuantizeMethod;
if(picObj.HasMember("feature_clamp_value")){
float value=(int)picObj["feature_clamp_value"].GetFloat();
if(value<0.0f||value>127.0f){
MNN_ERROR("feature_clamp_value should be in(0,127],got:%fn",value);
return;
}
_featureClampValue=value;
}
if(picObj.HasMember("weight_clamp_value")){
float value=(int)picObj["weight_clamp_value"].GetFloat();
if(value<0.0f||value>127.0f){
MNN_ERROR("weight_clamp_value should be in(0,127],got:%fn",value);
return;
}
_weightClampValue=value;
}
DLOG(INFO)<<"feature_clamp_value:"<<_featureClampValue;
DLOG(INFO)<<"weight_clamp_value:"<<_weightClampValue;
if(picObj.HasMember("skip_quant_op_names")){
auto skip_quant_op_names=picObj["skip_quant_op_names"].GetArray();
for(auto iter=skip_quant_op_names.begin();iter!=skip_quant_op_names.end();iter++){
std::string skip_quant_op_name=iter->GetString();
_skip_quant_ops.emplace_back(skip_quant_op_name);
DLOG(INFO)<<"skip quant op name:"<<skip_quant_op_name;
}
}
if(picObj.HasMember("debug")){
_debug=picObj["debug"].GetBool();
}
}
std::shared_ptr<ImageProcess>process(ImageProcess::create(config));
_process=process;
//read images file names
Helper::readImages(_imgaes,imagePath.c_str(),&_imageNum);
_initMNNSession(modelBuffer,bufferSize,channles);
_initMaps();
}