Taskonomy: Disentangling Task Transfer Learning程序运行记录

源自:https://github.com/StanfordVL/taskonomy/tree/master/taskbank

 

安装

第1步:从Github克隆代码

git clone https://github.com/StanfordVL/taskonomy.git
cd taskonomy/taskbank

第2步:安装要求

Python:查看requirement.txt已用包的完整列表。我们建议使用virtualenv进行干净的安装需求:

conda create -n testenv pip python=3.4
source activate testenv
pip install -r requirement.txt 

运行单图像任务

taskonomy/taskbank文件夹中:

第1步:下载预训练网络

sh tools/download_model.sh

第2步:运行演示脚本

要在特定图像上运行任务的预训练模型,请执行以下操作:

python tools / run_img_task.py --task $ TASK --img $ PATH_TO_INPUT --store $ WHERE_TO_STORE

对于--task指定在查询图像上运行的任务的标志,请在“ 任务名称字典”中查找任务名称

例如,根据字典: Surface-Normal : rgb2sfnorm

python tools/run_img_task.py --task rgb2sfnorm --img assets/test.png --store assets/test_sf.png

例如,根据字典: Scene-Classification : class_places

python tools/run_img_task.py --task class_places --img assets/test.png --store assets/test_scene_class.png

同样,运行vanishing_pointcurvaturereshadergb2mistsegment25dtest.png返回的结果如下:

存储表示

该标志--store-rep可以保存由任务编码器生成的图像的表示。添加--store-rep到命令,表示将存储在

${WHERE_TO_STORE}.npy。例如,运行:

python tools/run_img_task.py --task class_places --img assets/test.png --store assets/test_scene_class.png --store-rep

will store the representation of test.png by the scene classification task encoder at assets/test_scene_class.npy.

存储预测

为了保存网络的数值预测,例如除了png可视化之外的预测消失点的坐标,使用标志--store-pred。添加--store-pred到命令,预测将存储在${WHERE_TO_STORE}_pred.npy。例如,运行:

python tools/run_img_task.py --task class_places --img assets/test.png --store assets/test_scene_class.png --store-pred

will store predicted scene classes at assets/test_scene_class.npy.

npy文件打开方式见网址:http://www.manongjc.com/article/3044.html

我的运行:/home/wei/MyPaperCode/taskonomy/taskbank/assets/npy文件打开方式.ipynb

运行多图像任务

在输入中运行具有多个图像的任务与单个图像任务的相同过程非常相似。

第1步:下载预训练网络

sh tools/download_model_multi.sh

第2步:运行演示脚本

要在特定图像上运行预训练的多图像模型(在Triplet-Fixated-Camera-Pose的情况下,--img应该是$IMG1,$IMG2,$IMG3因为任务需要输入3个图像。请参阅任务定义),执行:

python tools/run_multi_img_task.py --task $TASK --img $IMG1,$IMG2 --store $WHERE_TO_STORE

类似地,对于--task标志,在“ 任务名称字典”中查找任务名称。例如,根据字典:

Pairwise-Nonfixated-Camera-Pose : non_fixated_pose

然后,我们可以在示例图像1示例图像2上运行脚本:

python tools/run_multi_img_task.py --task non_fixated_pose --img assets/test_1.png,assets/test.png --store assets/test_pose.png

点匹配:请注意,如果输入images的中心像素对应于相同的物理点(即若它们形成“点对应”),则不匹配返回0,匹配返回1 。这个任务不生成可视化,--store用于与标志--store-rep--store-pred以确定在哪里保存representation and predicction。请参阅以下示例:

python tools/run_multi_img_task.py --task point_match --img assets/test_1.png,assets/test.png --store assets/point_match_results --store-rep --store-pred

猜你喜欢

转载自blog.csdn.net/infinita_LV/article/details/81431380
今日推荐