road detect/classification
每张图片使用train.cpp生成一个.txt文件, MixTxt.m合成一个总的txt. 注意图片的顺序,正负样本的分离,可将原来的txt适当混入
-----第二版----
[label,inst] = libsvmread('./.txt); train_data = inst(1:sss,:); train_label = label(1:sss,:); [tl,ti] = libsvmread('./sss.txt); test_data = ti(1:sss,:); test_label = tl(1:sss,:); model_linear = svmtrain(train_label, train_data, '-c 333 -g 0.5 -h 1'); [predict_label_L, accuracy_L, dec_values_L] = svmpredict(test_label, test_data, model_linear); -----第一版---- [label,inst] = libsvmread('./.txt); L = randperm( length(label) ); %Split Data train_data = inst(L(1:40000),:); train_label = label(L(1:40000),:); test_data = inst(L(40001:61848),:); test_label = label(L(40001:61848),:); %Linear Kernel model_linear = svmtrain(train_label, train_data, '-c 1 -g 0.5 -h 1'); %-c惩罚因子; -g 核函数参数,输入数据中的属性数,默认类别数目的倒数;调参的主要方法有Gridsearch,即穷举. %SVM的两个参数 C 和 gamma [predict_label_L, accuracy_L, dec_values_L] = svmpredict(test_label, test_data, model_linear); accuracy_L % Display the accuracy using linear kernel
cd 到libsvm-3.21文件夹 命令端输入: make ./svm-train -c 333 -g 0.5 -b 1 -h 1 train0603.txt t.model
遇到的问题:
OpenCV Error: Assertion failed (ssize.area() > 0) in resize, file /home/zc/tools/opencv-2.4.13/modules/imgproc/src/imgwarp.cpp, line 1968
terminate called after throwing an instance of 'cv::Exception'
what(): /home/zc/tools/opencv-2.4.13/modules/imgproc/src/imgwarp.cpp:1968: error: (-215) ssize.area() > 0 in function resize
出错原因:图片没读进来.改了格式,名称. https://stackoverflow.com/questions/31996367/opencv-resize-fails-on-large-image-with-error-215-ssize-area-0-in-funct
gdb filename run bt
.c 改为 .cpp 添加 .h文件,其中加入 #pragma once
//Automobile.h
#ifndef _AUTOMOBILE_H
#define _AUTOMOBILE_H
#else
//...
#endif
vs
//Automobile.h
#pragma once
//...
重复定义变量,前面+static
错因:string两边没有空格,应为:#include
Under Linux, one normally uses "uint32_t".
cmake -->makefile 构建:生成 '.o' 文件
点击文件夹,右键复制,不需要打开包含很多内容(图片)的文件夹.
如error:can't find ...,要能快速定位到这里
修改程序后,可清除后重新构建(保险).或者,直接构建即可(快). 删除或添加文件后,需要 右键项目名,然后执行CMake
Command line arguments: 注意模型文件要与可执行文件放在同一目录下
enca -L zh_CN -x utf-8 main.cpp
sed -i "s/oldString/newString/g"
grep oldString -rl yourDir
注意,该“`”符号并不是单引号,而是键盘左上角第二排第一个的按键。 如想将type1中的“载人”修改为“载物”,只需要在终端中输入:
sed -i "s/载人/载物/g"
grep 载人 -rl /home/ubuntu/annotation/
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。