1 Star 0 Fork 1

fastsafe/keras-yolo3-detection

forked from MSNH/keras-yolo3-detection 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
img_generator.py 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
wcl1 提交于 2019-01-03 16:45 . update
#!/usr/bin/env python
# -- coding: utf-8 --
"""
Copyright (c) 2019. All rights reserved.
Created by C. L. Wang on 2019/1/3
"""
from project_utils import *
from root_dir import ROOT_DIR
from yolo3_predict import YOLO
def generate_data(file_name):
print('执行开始')
out_file = os.path.join(ROOT_DIR, 'dataset', file_name)
create_file(out_file)
up_folder = os.path.abspath(os.path.join(ROOT_DIR, '..'))
data_folder = os.path.join(up_folder, 'data_set', 'XX-Images-57w-416')
path_list, name_list = traverse_dir_files(data_folder)
yolo = YOLO()
for count, (path, name) in enumerate(zip(path_list, name_list)):
# print(path, name)
try:
objects_line = yolo.detect_objects_of_image(path)
except Exception as e:
print("错误: {}".format(name))
continue
if not objects_line:
continue
# print(objects_line)
print("已处理: {}".format(name))
data_line = '{}---{}'.format(name, objects_line)
write_line_utf8(out_file, data_line)
if count % 1000 == 0:
print('count: {}'.format(count))
# break
yolo.close_session()
print('执行结束')
if __name__ == '__main__':
file_name = 'dataset_57w_objects.txt'
generate_data(file_name)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/fastsafe/keras-yolo3-detection.git
git@gitee.com:fastsafe/keras-yolo3-detection.git
fastsafe
keras-yolo3-detection
keras-yolo3-detection
master

搜索帮助