Comments (8)
labels使用前未定义,原因是这句上面的if判断没进去,labels是if里面定义的。应该是你的样本里面有负样本,没有labels,你可以去掉这些负样本,或者给if加一个
else:
labels = np.zeros((0,5), dtype=np.float32)
生成一个0标签,这个工程用的原版的yolov3是有这一句的。
不知道有负样本对稀疏训练会不会有影响。
from yolov3-channel-and-layer-pruning.
from yolov3-channel-and-layer-pruning.
labels使用前未定义,原因是这句上面的if判断没进去,labels是if里面定义的。应该是你的样本里面有负样本,没有labels,你可以去掉这些负样本,或者给if加一个
else:
labels = np.zeros((0,5), dtype=np.float32)
生成一个0标签,这个工程用的原版的yolov3是有这一句的。
不知道有负样本对稀疏训练会不会有影响。
原版没找到这句哎
from yolov3-channel-and-layer-pruning.
@FishEatApple
以前的版本是有的,可能后来又删了。
from yolov3-channel-and-layer-pruning.
@FishEatApple
以前的版本是有的,可能后来又删了。
还有一个问题,是不是应该是
labels = np.zeros((1,5), dtype=np.float32)
而不是
labels = np.zeros((0,5), dtype=np.float32)
也就是说将未标注的负样本图片的类别与坐标全部置零,这样才能参与训练和计算损失函数嘛,我说的对吗?
from yolov3-channel-and-layer-pruning.
@FishEatApple
就是(0,5),这个其实就是起一个占位的作用,只定义了一个shape和labels一样的空值而已。没有标注的负样本就是没有label,如果都写成0,那就是认为负样本含有有效的目标了,只不过坐标都是零,我没试过不知道会不会报错,但是这样处理是不对的。目标检测的loss计算中的正负样本,不是指图片是正负样本,而是指目标框,这个建议看一下各个检测框架对正负样本的选取。
from yolov3-channel-and-layer-pruning.
@FishEatApple
就是(0,5),这个其实就是起一个占位的作用,只定义了一个shape和labels一样的空值而已。没有标注的负样本就是没有label,如果都写成0,那就是认为负样本含有有效的目标了,只不过坐标都是零,我没试过不知道会不会报错,但是这样处理是不对的。目标检测的loss计算中的正负样本,不是指图片是正负样本,而是指目标框,这个建议看一下各个检测框架对正负样本的选取。
但是如果写成(0,5)的话,是会报错的,因为这样target的class和xywh是空值,pred的值无法与之计算loss了。我改成(1,5)后就能正常训练(但是不能使用focal loss了),而且模型实测是有效果的,但是我觉得(1,5)在理论上确实有点说不通,(1,5)的意思是没有目标的样本的class是0,xywh也是0。
from yolov3-channel-and-layer-pruning.
@FishEatApple
我写成0是正常的。不太清楚你的报错问题,不过写成1就真的是给图片添加了一个全0的label。你可以在原版里面找,2019年12月27号左右,我下载的有这一天的版本。也可能是作者改动的比较大了,比如现在的版本没有else这一句,而loss那一块对应的处理也和当时不一样了,所以加了会报错。或者你也可以不添加了,直接把labels4.append(labels)增加一个缩进。之前的报错就是因为负样本进不了上面的 if 导致 labels 没有定义,增加缩进就保证append一定能添加。
from yolov3-channel-and-layer-pruning.
Related Issues (20)
- 使用层和通道剪枝,map为0? HOT 4
- Can I use this to prune model MobileNetv2-Yolov4
- ValueError: not enough values to unpack (expected 2, got 1)
- 关于稀疏训练和剪枝的阈值
- 进行yolov4稀疏化训练 HOT 3
- 关于其他数据集标注格式要进行的代码修改
- 为什么稀疏训练和剪枝都要将yolov3赋给darknet?
- What are the flags -sr ,--s 0.001 ,--prune 1 --global_percent flag while doing pruning
- 刚开始推理时,GPU内存占用持续增加
- 训练时候出现一个问题 soft rratio是0测试时候 P R mAP F1也是nan这种情况怎么办呢
- The P R F1-score and [email protected] are around 90% after sparse training (--s 0.001 --prune 0). Still the sparse model is not performing well on the test dataset.
- 通道剪枝的时候遇到问题~ HOT 1
- 请问支持分组卷积的枝剪吗 HOT 1
- data文件夹下的.shapes文件需要自己准备吗?
- ValueError: Number of rows must be a positive integer, not 4.0 HOT 3
- 剪枝改进后的模型
- RuntimeError: shape '[128, 64, 3, 3]' is invalid for input of size 7067 训练v3报错
- 可以正常剪枝,但是微调并没有提升map,且微调后的bn_weight的大部分值仍接近0?
- How to transfor the pt model to ONNX format
- 在windows下没有生成val.shapes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yolov3-channel-and-layer-pruning.