美文网首页
SKU 检测项目部署

SKU 检测项目部署

作者: HansenGuan | 来源:发表于2018-10-12 16:48 被阅读0次

运行环境:

  • Python >= 3.5
  • Anaconda3(默认环境为 Python3),如果安装了 Anaconda2 需先安装 Python 3 环境,然后修改 PYTHONPATH 指向 Anaconda 环境下 Python 3 的目录
  • Tensorflow == 1.5
  • cuda == 9
  • Redis
  • RabbitMQ

Python 3 安装 Tensorflow

# For CPU
pip install tensorflow==1.6
# For GPU
pip install tensorflow-gpu==1.6

# 依赖包安装
pip install pillow==4.2.1
pip install lxml==3.8.0
pip install pika==0.11.2
pip install redis==2.10.6

SKU 检测项目

内网
http://172.16.0.141/xtionAIproject/xtionObjectDetectionService/tree/object_detect_service_v2
外网
http://183.63.72.242:6150/xtionAIproject/xtionObjectDetectionService/tree/object_detect_service_v2

|- XtionObjectDetectProject_v2
|  |- commons  (公共依赖包)
|  |- utils  (工具包)
|  |- config (项目配置文件目录)
|  |- object_detection  (SKU 检测包)
|  |- service_consumer  (消息消费服务包)
|  |- service_detect  (SKU 检测包)
|  |- service_publisher  (消息发布服务包)
|  |- rabbitmq_consumer_main.py  (消息消费服务启动入口)
|  |- rabbitmq_publisher_main.py  (消息发布服务启动入口)
|  |- process_crawler_main.py  (图片下载服务启动入口)
|  |- object_detect_main.py  (SKU 检测服务启动入口)

配置

XtionObjectDetectProject_v2/config /config.py:

# 指定配置文件
configs = readYAMLconfig("config-test.yaml")

配置文件模板:
config-default.yaml :

env_name: DEFAULT

MODE:
  FIFO: 1
  PRIORITY: 2

logger:
  log_path: 'F:\\Desktop\\detect_service_logs'
  lognum: 10
  logsize: 8

redis:
  db: 0
  host: localhost
  port: 6379
  keys:
    root_key: AI_SKU_DETECTION


global_config:
  mode: 1
  service_expire_time: 5


redis_keys:
  list:
    FIFO: FIFO_LIST
    PRIORITY: PRIORITY_LIST
    result_list: RESULTS
    source_list: SOURCES
  pre_load:
    fifo_loaded_list: FIFO_LOADED_LIST
    image_data: IMAGES
    pre_load_list: PRE_LOAD_LIST
    priority_loaded_list: PRIORITY_LOADED_LIST
  sections:
    section1: SECTION_1
    section2: SECTION_2
    section3: SECTION_3
  string:
    root_key: AI_SKU_DETECTION


rabbitmq:
  connection_reconnect_times: 5
  host: 47.106.89.15
  vhost: /
  port: 5672
  password: guest
  username: guest


rabbitmq_queues:
  result_queue:
    DEFAULT: DEFAULT_RESULT_QUEUE
    FIFO: FIFO_RESULT_QUEUE
    PRIORTITY: PRIORTITY_RESULT_QUEUE
  source_queue:
    FIFO: FIFO_SOURCE_QUEUE
    PRIORTITY: PRIORTITY_SOURCE_QUEUE


service_state:
  monitor_state: monitor
  running_identity: identity

real_time_request_timeout: 30

service_consumer:
  configs_redis_key: configs


service_preload:
  download_failed_retry: 1
  download_timeout: 5
  max_num: 50


service_detect:
  ckpt_path: 'F:\\Desktop\\models\\xtionObjectDetectionService\\models\\20180404\\frozen_inference_graph.pb'
  labels_path: 'F:\\Desktop\\models\\xtionObjectDetectionService\\models\\20180404\\mscoco_label_map_20180404.pbtxt'
  min_score_thresh: 0.75
  model_name: 'sku detect model'
  num_class: 90
  per_process_gpu_memory_fraction: 0.5


service_publihser:
  exchange_name: DIRECT_EXCHANGE_NAME
  exchange_type: direct
  fifo_rooting_key: KEY.FIFO_QUEUE,
  priority_rooting_key: KEY.PRIORITY_QUEUE
  sleep_time: 0.005

配置解析

  • redis 缓存服务相关配置

    • ···
  • rabbitmq 消息服务配置

    • connection_reconnect_times 连接重连次数
    • ···
  • rabbitmq_queues 消息队列相关配置

    • source_queue 消费者队列相关配置
      • FIFO 先进先出队列名
      • PRIORTITY 优先级队列名
    • result_queue 发布者队列相关配置
      • FIFO 先进先出队列名
      • PRIORTITY 优先级队列名
  • real_time_request_timeout 实时检测超时设置

  • service_preload 图片预加载相关设置

    • download_failed_retry 下载失败重试次数
    • download_timeout 下载超时设置
    • max_num 预加载最大数量
  • service_detect SKU 检测服务相关配置

    • ckpt_path 指定模型文件路径
    • service_detect.labels_path 指定标注映射文件路径
    • min_score_thresh 最小分数阈值,低于该阈值直接过滤
    • num_class 指定样本总数
    • per_process_gpu_memory_fraction 指定 tensorflow 使用 GPU 显存的比例

相关文章

网友评论

      本文标题:SKU 检测项目部署

      本文链接:https://www.haomeiwen.com/subject/bfqboftx.html