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

简介:   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代码实现,涉及景点评分统计、城市综合评价、游玩路线规划以及特定条件下的旅游优化问题。
1789 6
【2024年华数杯全国大学生数学建模竞赛】C题:老外游中国 问题思路分析及Python代码实现
|
JavaScript 前端开发
webpack5不要再用url-loader了
webpack5 新增 Asset Modules 资源模块
425 0
|
数据可视化 测试技术 API
RESTClient 使用教程
Wisdom RESTClient 一款自动化测试REST API的工具,它可以自动化测试RESTful API并生成精美的测试报告,同时基于测试过的历史API,可以生成精美的RESTful API文档。本文将介绍如何使用RESTClient测试REST API和生成API文档的详细步骤。
4373 0
|
1天前
|
云安全 数据采集 人工智能
古茗联名引爆全网,阿里云三层防护助力对抗黑产
阿里云三层校验+风险识别,为古茗每一杯奶茶保驾护航!
古茗联名引爆全网,阿里云三层防护助力对抗黑产
|
5天前
|
Kubernetes 算法 Go
Kubeflow-Katib-架构学习指南
本指南带你深入 Kubeflow 核心组件 Katib,一个 Kubernetes 原生的自动化机器学习系统。从架构解析、代码结构到技能清单与学习路径,助你由浅入深掌握超参数调优与神经架构搜索,实现从使用到贡献的进阶之旅。
278 139
|
5天前
|
人工智能 中间件 API
AutoGen for .NET - 架构学习指南
《AutoGen for .NET 架构学习指南》系统解析微软多智能体框架,涵盖新旧双架构、核心设计、技术栈与实战路径,助你从入门到精通,构建分布式AI协同系统。
296 142
|
16天前
|
存储 关系型数据库 分布式数据库
PostgreSQL 18 发布,快来 PolarDB 尝鲜!
PostgreSQL 18 发布,PolarDB for PostgreSQL 全面兼容。新版本支持异步I/O、UUIDv7、虚拟生成列、逻辑复制增强及OAuth认证,显著提升性能与安全。PolarDB-PG 18 支持存算分离架构,融合海量弹性存储与极致计算性能,搭配丰富插件生态,为企业提供高效、稳定、灵活的云数据库解决方案,助力企业数字化转型如虎添翼!