【DETR】从无到有的程序试跑过程
DETR论文地址: DETR源码下载:
1. 当我一无所知时,我先去读README
1.1 Model Zoo是什么?
1.2 Colab是什么?
朋友们,我发现了一个什么宝藏呀!
Colaboratory 是一个免费的 Jupyter 笔记本环境,不需要进行任何设置就可以使用,并且完全在云端运行。 借助 Colaboratory,可以编写和执行代码、保存和共享分析结果,以及利用强大的计算资源,所有这些都可通过浏览器免费使用。
这是给没有GPU以及GPU性能较差的小伙伴一个便利啊!在README中提供的是现成的Colab Notebook提供学习。但是以后可以使用Colaboratory进行训练什么的,慢慢研究。
2. 大致掌握DETR(Grasp on DETR)
We provide a few notebooks in colab to help you get a grasp on DETR: DETR’s hands on Colab Notebook: Shows how to load a model from hub, generate predictions, then visualize the attention of the model (similar to the figures of the paper) Standalone Colab Notebook: In this notebook, we demonstrate how to implement a simplified version of DETR from the grounds up in 50 lines of Python, then visualize the predictions. It is a good starting point if you want to gain better understanding the architecture and poke around before diving in the codebase. Panoptic Colab Notebook: Demonstrates how to use DETR for panoptic segmentation and plot the predictions.
官方提供了三个Colab Notebook,那我们一个个来看。
- 展示如何下载模型,进行预测。
- 简化版本。
- 演示分割任务。
3. 论文和源码
如果前面Colab Notebook的内容只是小菜,下载的源码就是大餐。 我想先尝试运行一下测试的代码,结果没有找到相应的程序,感觉源码写的是一个训练的过程,因此我将"DETR’s hands on Colab Notebook"中的代码复制组成了detect.py文件,进行适当的修改,用于测试运行结果,代码如下:
以下是几点说明:
- 需要创建存放待测试图片的文件夹‘data/images/‘和运行结果完后的文件夹’runs/detect/’,如文件夹名不相同,需修改代码第108和136行,文件夹创建情况如下图:
- 图片格式jpg或png都可,有一个函数实现png到jpg的转换。
4. 效果
[-] 加入colab的使用心得 [-] 加入DETR检测视频
