参考文档:https://zhuanlan.zhihu.com/p/64605565

 官网:https://github.com/facebookresearch/maskrcnn-benchmark/blob/main/INSTALL.md

最好还是看官网,帖子作为参考

创建一个空的虚拟环境吧

conda create -n maskrcnn python=3.9
conda activate maskrcnn

踩坑:pytorch的版本非常重要,不要太新。1.8

https://github.com/facebookresearch/maskrcnn-benchmark/issues/1236

1. 环境:

  cuda 11.1.1

  pytorch pytorch-nightly torchvision :根据自己cuda的环境,我用pip下载的

  ninja yacs cython matplotlib tqdm opencv-python

 

创建个文件夹,放整个项目,安装cocoapi cityscapesScript apex maskrcnn-benchmark 都以这个文件夹为父文件夹

2. 安装cocoapi

  git clone https://github.com/cocodataset/cocoapi.git
  cd cocoapi/PythonAPI
  python setup.py build_ext install

3. 安装cityscapesScripts

  git clone https://github.com/mcordts/cityscapesScripts.git
  cd cityscapesScripts/
  python setup.py build_ext install

4. 安装apex(我是出问题了)

  git clone https://github.com/NVIDIA/apex.git
  cd apex
  python setup.py install 

4. 安装maskrcnn-benchmark

  git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
  cd maskrcnn-benchmark

  # the following will install the lib with
  # symbolic links, so that you can modify
  # the files if you want and won't need to
  # re-build it
  python setup.py build develop

   报错:

    

 

 

  尝试1:https://github.com/amazon-science/siam-mot/blob/main/readme/INSTALL.md

  cuda_dir="maskrcnn_benchmark/csrc/cuda"
  perl -i -pe 's/AT_CHECK/TORCH_CHECK/' $cuda_dir/deform_pool_cuda.cu $cuda_dir/deform_conv_cuda.cu
  # You can then run the regular setup command
  python setup.py build develop
  

    尝试2: 

   

 

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. cinfig 不是configs

   

   分类数量需要改成自己的数量+1(背景) 

   

 

   

7. 训练

  python tools/train_net.py --config-file configs/my_e2e_mask_rcnn_R_50_FPN_1x.yaml

  

 

    报错:

  解决:就是没有编译好     

 

  报错:

 

 

  解决:

  修改报错文件import.py

  3 改成37

 

  报错:

 

 

  解决:

  https://blog.csdn.net/weixin_59726951/article/details/127585754

  报错:

 

 

  解决:

降低nupy版本,1.23.5

  报错:

 

 

  解决:

  

8. 测试 

验证:python tools/test_net.py --config-file configs/e2e_mask_rcnn_R_101_FPN_1x.yaml

  问题

posted on   黑逍逍  阅读(146)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!



点击右上角即可分享
微信分享提示