# recycle-scaner **Repository Path**: thales-ucas/recycle-scaner ## Basic Information - **Project Name**: recycle-scaner - **Description**: 回收扫描 - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-07-11 - **Last Updated**: 2023-06-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 回收扫描 通过图片视频或者AR识别图片中的商品,并把商品进入快速回收 ## 工具 - python - yolo5 ## 安装 使用conda安装 ``` conda install --file requirements.txt ``` 但是有几个不能直接安装,需要特殊处理一下 1. pytorch > conda install pytorch torchvision -c pytorch 2. opencv4 > https://pypi.tuna.tsinghua.edu.cn/simple/opencv-python/ 下载需要的whl > 我的是mac,python3.8所以下载下面的 > pip install opencv_python-4.5.2.54-cp38-cp38-macosx_10_15_x86_64.whl 3. thop > pip install --upgrade git+https://github.com/Lyken17/pytorch-OpCounter.git ## 训练集 给图片打标 ![image](./docs/image.jpg) ![label](./docs/label.png) > 一张图片就配合一张label > 按照顺序是 > 标签、x、y、width、height 可以使用下面的网站,专门配合打标 https://www.makesense.ai/ 最终输出yolo格式 # juypter记事本 ## 训练 ```py python train.py --img 640 --batch 16 --epochs 3 --data data/recycle.yaml --hyp data/hyp.scratch.yaml --weights data/model/origin.pt --cache ``` ## 检测 ```py python detect.py --weights data/model/recycle.pt --img 640 --conf 0.25 --source detect/ ``` # 参数详解 ## hyp Hyperparameters for VOC finetuning ```yaml lr0: 0.00447 # 学习率 lrf: 0.114 # 余弦退火超参数 momentum: 0.873 # 学习率动量 weight_decay: 0.00047 # 权重衰减系数 giou: 0.0306 # giou损失的系数 cls: 0.211 # 分类损失的系数 cls_pw: 0.546 # 分类BCELoss中正样本的权重 obj: 0.421 # 有无物体损失的系数 obj_pw: 0.972 # 有无物体BCELoss中正样本的权重 iou_t: 0.2 # 标签与anchors的iou阈值iou training threshold anchor_t: 2.26 # 标签的长h宽w/anchor的长h_a宽w_a阈值, 即h/h_a, w/w_a都要在(1/2.26, 2.26)之间anchor-multiple threshold # anchors: 5.07 fl_gamma: 0.0 # 设为0则表示不使用focal loss(efficientDet default is gamma=1.5) # 下面是一些数据增强的系数, 包括颜色空间和图片空间 hsv_h: 0.0154 # 色调 hsv_s: 0.9 # 饱和度 hsv_v: 0.619 # 明度 degrees: 0.404 #旋转角度 translate: 0.206 # 水平和垂直平移 scale: 0.86 # 缩放 shear: 0.795 # 剪切 perspective: 0.0 # 透视变换参数 flipud: 0.00756 # 上下翻转 fliplr: 0.5 # 左右翻转 mixup: 0.153 # mixup系数 ``` # tensorboard ```bash load_ext tensorboard tensorboard --logdir runs/train ``` 可以在浏览器中访问 > http://localhost:6006