【发布时间】:2014-05-01 20:28:52
【问题描述】:
我在我的OPENCV_ROOT 文件夹中并在 Win-x64 中运行以下命令:
opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1
maxzangle 0.5 -maxidev 40 -w 80 -h 40
-img ABSOLUTE_PATH_TO_POSITIVE_IMAGES_FOLDER\car.jpg
-bg ABSOLUTE_PATH_TO_PROJECT\negatives.txt
-vec ABSOLUTE_PATH_TO_SAMPLES_FOLDER\car.jpg.vec
-num 125
我的negatives.txt 看起来像这样:
negative_images\city01_02.jpg
negative_images\city01_04.jpg
negative_images\city01_05.jpg
negative_images\city01_06.jpg
negative_images\city01_07.jpg
这是我的输出:
Info file name: (NULL)
Img file name: ABSOLUTE_PATH_TO_POSITIVE_IMAGES_FOLDER\car.jpg
Vec file name: ABSOLUTE_PATH_TO_SAMPLES_FOLDER\car.jpg.vec
BG file name: ABSOLUTE_PATH_TO_PROJECT\negatives.txt
Num: 125
BG color: 0
BG threshold: 0
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 80
Height: 40
Create training samples from single image applying distortions...
Invalid background description file.
我的底片收集文件 (negatives.txt) 有什么无效的地方?我尝试使用绝对路径和相对路径列出其中的文件。我正在关注this 教程。
【问题讨论】:
-
这是一个棘手的问题。唔。您是否尝试过在negatives.txt 中命名完整路径?例如,
C:\images\negative_images\city01_02.jpg而不仅仅是negative_images\city01_02.jpg? -
我怀疑的另一个原因可能是图像名称中的
_。 -
是的,我试过不带下划线,但没有任何区别。我还尝试在底片中使用完整路径。我什至将negative_images文件夹也复制到了带有opencv_createsamples二进制文件的文件夹中,但没有区别。
-
我已经成功了!问题只是我在 Notepad++ 中编写了集合文件名,一切看起来都很好。但是当我碰巧在记事本中打开同一个文件时,我注意到每个图像文件名后面都没有换行符!当我添加换行符时,我能够制作样本!然而,似乎负面因素并没有出现。当我查看样本时,它们按预期扭曲,但在黑色背景上,而不是在使用其中一张负片图像的背景上......知道吗?
-
嘿,我有一个不同的解决方案。基本上创建了一个空的 bg2.txt 文件并粘贴所有 bg.txt 文件内容。在这里看到它:stackoverflow.com/questions/37378638/…
标签: opencv computer-vision sample training-data