数据存储格式:
问题描述:
解决方法:
打开darknet/src/until.c
找到函数replace_image_to_label
将下述代码取消注释即可(212行)
void replace_image_to_label(char *input_path, char *output_path) {
...
find_replace(output_path, "JPEGImages", "labels", output_path); // PascalVOC
...
解决方法参考来源
问题描述:显存不足
解决方法:修改cfg文件中的subvision,增大
问题描述:训练过程中希望第100次以及每1000次存储一个权重
解决方法:修改detector.c文件(200行)
if (i % 1000 == 0 || i==100) {
//if (i % 100 == 0) {
//if(i >= (iter_save + 100)) {
//iter_save = i;
#ifdef GPU
if (ngpus != 1) sync_nets(nets, ngpus, 0);
#endif
char buff[256];
sprintf(buff, "%s/%s_%d.weights", backup_directory, base, i);
save_weights(net, buff);
}
问题描述:批量检测图片并将结果保存在特定文件夹内
解决方法:
static char picname[256] = {
""};
char fileroot[256] = {
"" };
char resroot[256] = {
"" };
char save_file[256] = {
"" };
strncpy(fileroot,input, strrchr(input, '\\') - input + 1);
strcat(resroot ,strcat(fileroot, "result"));
if (_access(resroot, 0) == -1)
{
int i = _mkdir(resroot);
}
strncpy(picname, strrchr(input, '\\')+1 , strrchr(input, '.')- strrchr(input, '\\'));
strcat(save_file,strcat(strcat(resroot,"\\"),picname));
save_image(im,save_file);
if (!dont_show) {
show_image(im, save_file);
}
检测命令行:
darknet.exe detector test data文件 cfg文件 weights文件 -dont_show < 检测文件列表txt > results.txt
问题:
解决方法:
函数:*fetch_in_thread(void *ptr)
if (!in_s.data) {
printf("Stream closed.\n");
flag_exit = 1;
//exit(EXIT_FAILURE);
return 0;
}
exit(EXIT_FAILURE);取消注释(这句原作者注释掉了,不明白为什么)
源码:
InputStream input = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
String szline = null;
while ((szline = reader.readLine()) != null) {
if (szline.equals("input video stream closed. ")) {
reader.close();
process.destroy();
break;
}
}
修改:
final InputStream input = process.getInputStream();
new Thread(new Runnable() {
public void run() {
BufferedReader br = new BufferedReader(new InputStreamReader(input));// 缓冲读入
try{
while(br.readLine() != null) ;
}
catch(Exception e) {
e.printStackTrace();
}
}
}).start(); // 启动单独的线程来清空p.getInputStream()的缓冲区
InputStream is2 = process.getErrorStream();// 获取p进程的输出流
BufferedReader br2 = new BufferedReader(new InputStreamReader(is2));
StringBuilder buf = new StringBuilder(); // 保存输出结果流
String line = null;
while((line = br2.readLine()) != null) buf.append(line); // 循环等待进程结束
解决方法原文:https://blog.csdn.net/u011984172/article/details/72732090