秒合约系统开发(开发项目)丨秒合约交易所系统开发(方案逻辑)/案例分析/源码设计/程序开发

简介:   Web3.0通过将信息交互从屏幕转移到物理空间,改变了终端用户体验,因而也有称Web3.0为“空间网络(Spatial Web)”。该“空间网络”包括空间交互层(利用智能眼镜或语音等实现实时信息交互)、数字信息层(借助传感和数字映射为每一个对象创建数字孪生)和物理层(通过感观了解和体验的世界)。

  

  Web3.0通过将信息交互从屏幕转移到物理空间,改变了终端用户体验,因而也有称Web3.0为“空间网络(Spatial Web)”。该“空间网络”包括空间交互层(利用智能眼镜或语音等实现实时信息交互)、数字信息层(借助传感和数字映射为每一个对象创建数字孪生)和物理层(通过感观了解和体验的世界)。

  DAPP是去中心化应用程序/分布式的应用程序,是底层区块链平台生态上衍生的各种分布式应用,也是区块链世界中的基础服务提供方。将应用程序分布在不同节点上,通过共识机制和区块链平台来完成任务的应用程序,它本身就是去中心化,不依赖于任何中心化服务器,促使用户交易更加安全。

  数据作为新型生产要素,能为实体经济带来放大、叠加和倍增作用,是做强做优做大数字经济的关键。建立数据可信流通体系,增强数据的可用、可信、可流通、可追溯水平,是激活数据要素潜能、赋能实体经济的重要途径。区块链技术具有去中心化、共识机制、不可篡改、可以追溯、规则透明等特点。

  int backendType[2];

  net->getSessionInfo(session,MNN::Interpreter::BACKENDS,backendType);

  MNN_PRINT("Session Info:memory use%f MB,flops is%f M,backendType is%d,batch size=%dn",memoryUsage,flops,backendType[0],argc-2);

  //获取输出tensor的信息

  auto output=net->getSessionOutput(session,NULL);

  if(nullptr==output||output->elementSize()==0){

  MNN_ERROR("Resize error,the model can't run batch:%dn",shape[0]);

  return 0;

  }

  //定义真正输入数据inputUser

  std::shared_ptr<Tensor>inputUser(new Tensor(input,Tensor::TENSORFLOW));

  auto bpp=inputUser->channel();

  auto size_h=inputUser->height();

  auto size_w=inputUser->width();

  MNN_PRINT("input:w:%d,h:%d,bpp:%dn",size_w,size_h,bpp);

  //依次填充batch张图片数据到inputUser

  for(int batch=0;batch<shape[0];++batch){

  auto inputPatch=argv[batch+2];

  int width,height,channel;

  auto inputImage=stbi_load(inputPatch,&width,&height,&channel,4);

  if(nullptr==inputImage){

  MNN_ERROR("Can't open%sn",inputPatch);

  return 0;

  }

  MNN_PRINT("origin size:%d,%dn",width,height);

  //trans是图像变换矩阵,可以用来做缩放、旋转等图像变换,避免引入opencv

  Matrix trans;

  //Set transform,from dst scale to src,the ways below are both ok

  #ifdef USE_MAP_POINT

  float srcPoints[]={

  0.0f,0.0f,

  0.0f,(float)(height-1),

  (float)(width-1),0.0f,

  (float)(width-1),(float)(height-1),

  };

  float dstPoints[]={

  0.0f,0.0f,

  0.0f,(float)(size_h-1),

  (float)(size_w-1),0.0f,

  (float)(size_w-1),(float)(size_h-1),

  };

  trans.setPolyToPoly((Point)dstPoints,(Point)srcPoints,4);

  #else

  trans.setScale((float)(width-1)/(size_w-1),(float)(height-1)/(size_h-1));

  #endif

  //MNN中使用CV::ImageProcess进行图像处理

  ImageProcess::Config config;

  config.filterType=BILINEAR;

  float mean[3]={103.94f,116.78f,123.68f};

  float normals[3]={0.017f,0.017f,0.017f};

  //float mean[3]={127.5f,127.5f,127.5f};

  //float normals[3]={0.00785f,0.00785f,0.00785f};

  ::memcpy(config.mean,mean,sizeof(mean));

  ::memcpy(config.normal,normals,sizeof(normals));

  //图像格式转换:RGBA(.png)->BGR(模型输入要求)

  config.sourceFormat=RGBA;

  config.destFormat=BGR;

  std::shared_ptr<ImageProcess>pretreat(ImageProcess::create(config));

  pretreat->setMatrix(trans);

  //执行图像处理

  pretreat->convert((uint8_t)inputImage,width,height,0,inputUser->host<uint8_t>()+inputUser->stride(0)batch*inputUser->getType().bytes(),size_w,size_h,bpp,0,inputUser->getType());

  stbi_image_free(inputImage);

  }

  //拷贝真实输入数据到会话中

  input->copyFromHostTensor(inputUser.get());

  //执行会话

  net->runSession(session);

  auto dimType=output->getDimensionType();

  if(output->getType().code!=halide_type_float){

  dimType=Tensor::TENSORFLOW;

  }

  //定义输出数据承接outputUser

  std::shared_ptr<Tensor>outputUser(new Tensor(output,dimType));

  //拷贝到outputUser

  output->copyToHostTensor(outputUser.get());

  //获取输出类型:可能是数据类型?

  auto type=outputUser->getType();

  //对每一张图

  for(int batch=0;batch<shape[0];++batch){

  MNN_PRINT("For Image:%sn",argv[batch+2]);

  auto size=outputUser->stride(0);

  //用std::pair承接序号,置信度

  std::vector<std::pair<int,float>>tempValues(size);

  //对每种输出类型,分别解析

  if(type.code==halide_type_float){

  auto values=outputUser->host<float>()+batch*outputUser->stride(0);

  for(int i=0;i<size;++i){

  tempValues<i>=std::make_pair(i,values<i>);

  }

  }

  if(type.code==halide_type_uint&&type.bytes()==1){

  auto values=outputUser->host<uint8_t>()+batch*outputUser->stride(0);

  for(int i=0;i<size;++i){

  tempValues<i>=std::make_pair(i,values<i>);

  }

  }

  if(type.code==halide_type_int&&type.bytes()==1){

  auto values=outputUser->host<int8_t>()+batch*outputUser->stride(0);

  for(int i=0;i<size;++i){

  tempValues<i>=std::make_pair(i,values<i>);

  }

  }

  //Find Max按置信度排序

  std::sort(tempValues.begin(),tempValues.end(),

  {return a.second>b.second;});

  //打印top10信息

  int length=size>10?10:size;

  for(int i=0;i<length;++i){

  MNN_PRINT("%d,%fn",tempValues<i>.first,tempValues<i>.second);

  }

  }

  return 0;

  }

相关文章
|
算法 搜索推荐 数据挖掘
【2024年华数杯全国大学生数学建模竞赛】C题:老外游中国 问题思路分析及Python代码实现
本文提供了2024年华数杯全国大学生数学建模竞赛C题“老外游中国”的解题思路分析和Python代码实现,涉及景点评分统计、城市综合评价、游玩路线规划以及特定条件下的旅游优化问题。
1953 6
【2024年华数杯全国大学生数学建模竞赛】C题:老外游中国 问题思路分析及Python代码实现
|
JavaScript 前端开发
webpack5不要再用url-loader了
webpack5 新增 Asset Modules 资源模块
498 0
|
数据可视化 测试技术 API
RESTClient 使用教程
Wisdom RESTClient 一款自动化测试REST API的工具,它可以自动化测试RESTful API并生成精美的测试报告,同时基于测试过的历史API,可以生成精美的RESTful API文档。本文将介绍如何使用RESTClient测试REST API和生成API文档的详细步骤。
4428 0
|
1天前
|
存储 JavaScript 前端开发
JavaScript基础
本节讲解JavaScript基础核心知识:涵盖值类型与引用类型区别、typeof检测类型及局限性、===与==差异及应用场景、内置函数与对象、原型链五规则、属性查找机制、instanceof原理,以及this指向和箭头函数中this的绑定时机。重点突出类型判断、原型继承与this机制,助力深入理解JS面向对象机制。(238字)
|
2天前
|
安全 数据可视化 网络安全
安全无小事|阿里云先知众测,为企业筑牢防线
专为企业打造的漏洞信息收集平台
1303 2
|
3天前
|
云安全 人工智能
2025,阿里云安全的“年度报告”
拥抱AI时代,阿里云安全为你护航~
1448 2
|
2天前
|
人工智能 自然语言处理 API
n8n:流程自动化、智能化利器
流程自动化助你在重复的业务流程中节省时间,可通过自然语言直接创建工作流啦。
336 4
n8n:流程自动化、智能化利器
|
10天前
|
机器学习/深度学习 安全 API
MAI-UI 开源:通用 GUI 智能体基座登顶 SOTA!
MAI-UI是通义实验室推出的全尺寸GUI智能体基座模型,原生集成用户交互、MCP工具调用与端云协同能力。支持跨App操作、模糊语义理解与主动提问澄清,通过大规模在线强化学习实现复杂任务自动化,在出行、办公等高频场景中表现卓越,已登顶ScreenSpot-Pro、MobileWorld等多项SOTA评测。
1429 7