1. 程式人生 > >spring cloud + mybatis 分布式 微服務 b2b2c 多商戶商城 全球部署方案

spring cloud + mybatis 分布式 微服務 b2b2c 多商戶商城 全球部署方案

library nsh ger 聲明式 add demo 三方 copyright print

  用java實施的電子商務平臺太少了,使用spring cloud技術構建的b2b2c電子商務平臺更少,大型企業分布式互聯網電子商務平臺,推出PC+微信+APP+雲服務的雲商平臺系統,其中包括B2B、B2C、C2C、O2O、新零售、直播電商等子平臺。需要JAVA Spring Cloud大型企業分布式微服務雲構建的B2B2C電子商務平臺源碼 一零三八七七四六二六。
  
  技術解決方案
  
  開發語言: java、j2ee
  
  數據庫:mysql
  
  JDK支持版本: JDK1.6、JDK1.7、JDK1.8版本
  
  核心技術:分布式、雲服務、微服務、服務編排等。
  
  核心架構: 使用Spring Cloud分布式微服務雲架構進行服務化開發,所有模塊功能完全解耦,提供服務發現、註冊、配置中心、消息總線、負載均衡、斷路器、數據監控等。

  
  技術列表:
  
  Spring Cloud Config
  
  配置管理工具包,讓你可以把配置放到遠程服務器,集中化管理集群配置,目前支持本地存儲、Git以及Subversion
  
  Spring Cloud Bus
  
  事件、消息總線,用於在集群(例如,配置變化事件)中傳播狀態變化,可與Spring Cloud Config聯合實現熱部署
  
  Eureka
  
  雲端服務發現,一個基於 REST 的服務,用於定位服務,以實現雲端中間層服務發現和故障轉移。
  
  Hystrix
  
  熔斷器,容錯管理工具,旨在通過熔斷機制控制服務和第三方庫的節點,從而對延遲和故障提供更強大的容錯能力。
  
  Zuul
  
  Zuul 是在雲平臺上提供動態路由,監控,彈性,安全等邊緣服務的框架。Zuul 相當於是設備和 Netflix 流應用的 Web 網站後端所有請求的前門。
  
  Spring Cloud Security
  
  基於spring security的安全工具包,為你的應用程序添加安全控制。
  
  Feign
  
  Feign是一種聲明式、模板化的HTTP客戶端。
  
  Four Steps to Deep Learning
  
  System Setup
  
  Image Recognition
  
  Object Detection
  
  Segmentation
  
  CUDA
  
  一種並行計算技術
  
  編寫自己的圖像識別程序.
  
  https://github.com/dusty-nv/jetson-inference/tree/master/examples/my-recognition
  
  /*
  
  * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
  
  *
  
  * Permission is hereby granted, free of charge, to any person obtaining a
  
  * copy of this software and associated documentation files (the "Software"),
  
  * to deal in the Software without restriction, including without limitation
  
  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  
  * and/or sell copies of the Software, and to permit persons to whom the
  
  * Software is furnished to do so, subject to the following conditions:
  
  *
  
  * The above copyright notice and this permission notice shall be included in
  
  * all copies or substantial portions of the Software.
  
  *
  
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  
  * DEALINGS IN THE SOFTWARE.
  
  */
  
  // include imageNet header for image recognition
  
  #include <jetson-inference/imageNet.h>
  
  // include loadImage header for loading images
  
  #include <jetson-utils/loadImage.h>
  
  // main entry point
  
  int main( int argc, char** argv )
  
  {
  
  // a command line argument containing the image filename is expected,
  
  // so make sure we have at least 2 args (the first arg is the program)
  
  if( argc < 2 )
  
  {
  
  printf("my-recognition: expected image filename as argument\n");
  
  printf("example usage: ./my-recognition my_image.jpg\n");
  
  return 0;
  
  }
  
  // retrieve the image filename from the array of command line args
  
  const char* imgFilename = argv[1];
  
  // these variables will be used to store the image data and dimensions
  
  // the image data will be stored in shared CPU/GPU memory, so there are
  
  // pointers for the CPU and GPU (both reference the same physical memory)
  
  float* imgCPU = NULL; // CPU pointer to floating-point RGBA image data
  
  float* imgCUDA = NULL; // GPU pointer to floating-point RGBA image data
  
  int imgWidth = 0; // width of the image (in pixels)
  
  int imgHeight = 0; // height of the image (in pixels)
  
  // load the image from disk as float4 RGBA (32 bits per channel, 128 bits per pixel)
  
  if( !loadImageRGBA(imgFilename, (float4**)&imgCPU, (float4**)&imgCUDA, &imgWidth, &imgHeight) )
  
  {
  
  printf("failed to load image ‘%s‘\n", imgFilename);
  
  return 0;
  
  }
  
  // load the GoogleNet image recognition network with TensorRT
  
  // you can use imageNet::ALEXNET to load AlexNet model instead
  
  imageNet* net = imageNet::Create(imageNet::GOOGLENET);
  
  // check to make sure that the network model loaded properly
  
  if( !net )
  
  {
  
  printf("failed to load image recognition network\n");
  
  return 0;
  
  }
  
  // this variable will store the confidence of the classification (between 0 and 1)
  
  float confidence = 0.0;
  
  // classify the image with TensorRT on the GPU (hence we use the CUDA pointer)
  
  // this will return the index of the object class that the image was recognized as (or -1 on error)
  
  const int classIndex = net->Classify(imgCUDA, imgWidth, imgHeight, &confidence);
  
  // make sure a valid classification result was returned
  
  if( classIndex >= 0 )
  
  {
  
  // retrieve the name/description of the object class index
  
  const char* classDescription = net->GetClassDesc(classIndex);
  
  // print out the classification results
  
  printf("image is recognized as ‘%s‘ (class #%i) with %f%% confidence\n",
  
  classDescription, classIndex, confidence * 100.0f);
  
  }
  
  else
  
  {
  
  // if Classify() returned < 0, an error occurred
  
  printf("failed to classify image\n");
  
  }
  
  // free the network‘s resources before shutting down
  
  delete net;
  
  // this is the end of the example!
  
  return 0;
  
  }
  
  載入圖像 loadImageRGBA
  
  加載的圖像存儲於共享內存,映射到cpu和gpu.實際的內存裏的image只有1份,cpu/gpu pointer指向的都是同一份物理內存。
  
  The loaded image will be stored in shared memory that‘s mapped to both the CPU and GPU. There are two pointers available for access in the CPU and GPU address spaces, but there is really only one copy of the image in memory. Both the CPU and GPU pointers resolve to the same physical memory, without needing to perform memory copies (i.e. cudaMemcpy()).
  
  載入神經網絡模型
  
  imageNet::Create()
  
  GOOGLENET是一個預先訓練好的模型,使用的數據集是ImageNet(註意不是imageNet對象).類別有1000個,包括了動植物,常見生活用品等.
  
  // load the GoogleNet image recognition network with TensorRT
  
  // you can use imageNet::ALEXNET to load AlexNet model instead
  
  imageNet* net = imageNet::Create(imageNet::GOOGLENET);
  
  // check to make sure that the network model loaded properly
  
  if( !net )
  
  {
  
  printf("failed to load image recognition network\n");
  
  return 0;
  
  }
  
  對圖片進行分類
  
  Classify返回的是類別對應的index
  
  //this variable will store the confidence of the classification (www.hengtongyoule.com/ between 0 and 1)
  
  float confidence = 0.0;
  
  // classify the image with TensorRT on the GPU (hence we use the CUDA pointer)
  
  // this will return the index of the object class that the image was recognized as (www.tianjiuyule178.com or -1 on error)
  
  const int classIndex = net->Classify(imgCUDA,www.gaozhuoyiqi.com imgWidth, imgHeight, &confidence);
  
  解釋結果
  
  // make sure a valid classification result was returned
  
  if( classIndex >= 0 )
  
  {
  
  // retrieve the name/description of the object class index
  
  const char* classDescription = net->GetClassDesc(classIndex);
  
  // print out the classification results
  
  printf("image is recognized as ‘%s‘www.qwert888.com/ (class #%i) with %f%% confidence\n",
  
  classDescription, classIndex, confidence * 100.0f);
  
  }
  
  else
  
  {
  
  // if Classify() returned <www.zhongyiyul.cn 0, an error occurred
  
  printf("failed to classify image\n");
  
  }
  
  These descriptions of the 1000 classes are parsed from ilsvrc12_synset_words.txt when the network gets loaded (this file was previously downloaded when the jetson-inference repo was built).
  
  退出
  
  程序退出前要釋放掉資源
  
  // free the network‘s resources before shutting down
  
  delete net;
  
  // this is the end of the example!
  
  return 0;
  
  }
  
  cmake文件
  
  # require CMake 2.8 or greater
  
  cmake_minimum_required(VERSION 2.8)
  
  # declare my-recognition project
  
  project(my-recognition)
  
  # import jetson-inference and jetson-utils packages.
  
  # note that if you didn‘t do "sudo make install"
  
  # while building jetson-inference, this will error.
  
  find_package(jetson-utils)
  
  find_package(jetson-inference)
  
  # CUDA and Qt4 are required
  
  find_package(CUDA)
  
  find_package(Qt4)
  
  # setup Qt4 for build
  
  include(${QT_USE_FILE})
  
  add_definitions(${QT_DEFINITIONS})
  
  # compile the my-recognition program
  
  cuda_add_executable(my-www.yunshengyule178.com recognition my-recognition.cpp)
  
  # link my-recognition to jetson-inference library
  
  target_link_libraries(my-recognition jetson-inference)
  
  沒什麽要特別說的,主要的依賴如下:
  
  find_package(jetson-utils)
  
  find_package(jetson-inference)
  
  target_link_libraries(my-recognition jetson-inference)
  
  實時圖片識別
  
  上面的代碼展示的是本地圖片的識別,這一節給出實時的攝像頭拍攝圖片識別的demo.
  
  iamgenet-camera

spring cloud + mybatis 分布式 微服務 b2b2c 多商戶商城 全球部署方案