参考文档:https://blog.csdn.net/weixin_58577392/article/details/124828281
创建一个空的虚拟环境吧
1. 环境:
pytorch :根据自己cuda的环境
ninja yacs cython matplotlib tqdm opencv-python
2. 安装cocoapi
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext --inplace
python setup.py build_ext install
3. 安装apex
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./【报错】
python setup.py install
4. 安装maskrcnn-benchmark
git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
5. 自作自己coco数据集
1. git clone https://github.com/wkentaro/labelme.git
2. 放原始图片和json
3. 在rcnn项目下创建下面的空文件夹,2014或者2017【提前创建好】
4. 先运行一次,生成训练集的json(windows)
python labelme2coco.py data_annotated data_dataset_coco --labels labels.txt
就会生成新的data_dataset_coco文件夹,data_dataset_coco/annotations.json 改名 instances_train2017.json
把json和原始图片放在下面创建的coco文件夹中, annotations.json 改名 instances_train2017.json
在运行一次,生成验证集的json。其他步骤一样,json名字改成instances_val2017.json
6. 修改配置文件
在configs文件夹下
a.本人选择的是e2e_mask_rcnn_R_50_FPN_1x.yaml,复制并更名为my_e2e_mask_rcnn_R_50_FPN_1x.yaml。
然后修改这个yaml文件
最后
b.
7. 训练
python tools/train_net.py --config-file configs/my_e2e_mask_rcnn_R_50_FPN_1x.yaml
报错:
解决:
8. 测试