一、本地项目上传到Gitlab
1、新建工程
New project—Create project
新建的工程界面如下:
2、第一次使用需要配置SSH key
cd ~/.ssh/
# 如果提示“No such file or directory”,则手动创建
mkdir ~/.ssh
# 配置全局的Name和email,参照新建的工程Git global setup
git config --global user.name "HAD-lhh7510"
git config --global user.email "had-lhh7510@product.com"
# 生成key
ssh-keygen -t rsa -C "had-lhh7510@product.com"
# 后面均按回车
一路回车,就在系统路径下生成了私钥:id_rsa和公钥id_rsa.pub.
将id_rsa.pub的内容粘贴到gitlab密钥中:
3、上传项目
找到要上传的工程文件,右键git bush here
git config --global user.name "HAD-lhh7510"
git config --global user.email "had-lhh7510@product.com"
# 初始化一个仓库
git init
# 远程仓库名,远程仓库地址
git remote add origin git@gitlab.navinfo.com:HAD-lhh7510/0923.git
# 把文件添加到仓库
git add .
# 把文件提交到仓库
git commit -m "Initial commit"
# 将本地的master主分支推送到默认远程仓库名为origin的仓库
git push -u origin master
上传成功。
二、在AI平台上搜索并创建数据集
交通灯的编码规则可见于:四维云—人工智能—帮助中心—标注编码规范—交通灯
三、创建算法工程
四、导入数据集
五、新建notebook
gitlab的用户名和密码一定要填写正确,否则新建的镜像里面会没有工程代码。
六、查看代码和数据集
数据集在/root/data
代码仓库在/root/work
七、数据集格式转换
需要将AI平台的json转换成voc数据集格式,可以调用AI平台的SDK
1、新建config.yaml文件,内容如下:
INPUT_IMAGES_DIR: '/root/data/dataset-test/mydata0922/images/' # 输入图像路径
INPUT_LABELS_DIR: '/root/data/dataset-test/mydata0922/labels/' # 输入标注路径
OUTPUT_DIR: '/root/data/dataset-test/mydata0922/output/' # 转换后输出结果路径
2、新建rename_json.py,内容如下:
因为数据的命名格式不够规范,存在xxx.jpg.json,所以执行这个脚本,如果直接是xxx.json,可略过这个步骤。
import os
json_path = "/root/data/dataset-test/mydata0922/labels"
json_files = os.listdir(json_path)
for file in json_files:
str_file = file.split(".")
if str_file[1] == "jpg":
print("this file is to be renamed")
file1 = str_file[0]+ "." + str_file[2]
filepath1 = os.path.join(json_path,file)
filepath2 = os.path.join(json_path,file1)
os.rename(f