FlyingMoon-GitHub / ACNet

An unofficial Implementation of ACNet based on PyTorch.
20 stars 5 forks source link

关于实验结果 #1

Closed RollingWang closed 3 years ago

RollingWang commented 3 years ago

您好,请问你使用该代码复现出原论文的实验结果了吗?

FlyingMoon-GitHub commented 3 years ago

抱歉这份代码并未达到论文内所公布的结果,目前在CUB-200-2011数据集上的第一准确率大致是85.1%。 I'm sorry that the code doesn't achieve the performance claimed in the paper. The top-1 accuracy on the CUB-200-2011 dataset is about 85.1% at the present.

kwangabc commented 3 years ago

您好,请问这份代码对运行环境是怎么要求的

FlyingMoon-GitHub commented 3 years ago

我本人当前使用的运行配置是Python 3.5,PyTorch 1.1,torchvision 0.2.2,CUDA 10.1。 My current configuration is Python 3.5, PyTorch 1.1, torchvision 0.2.2 and CUDA 10.1.

kwangabc commented 3 years ago

我本人当前使用的运行配置是Python 3.5,PyTorch 1.1,torchvision 0.2.2,CUDA 10.1。 My current configuration is Python 3.5, PyTorch 1.1, torchvision 0.2.2 and CUDA 10.1.

好的,谢谢!

kwangabc commented 3 years ago

n您好,我现在想复现一下您的代码,但我遇到了数据集处理的问题,请问您的数据集是怎么设置的?非常感谢!

FlyingMoon-GitHub commented 3 years ago

请将图像数据与标记文件组织为如下形式: Please orgranize your image data and annotation files like:

+-- data
| +-- CUB-200-2011
| | +-- annos
| | | +-- annos_train.txt
| | | +-- annos_test.txt
| | | +-- annos_val.txt [optional]
| | +-- images
| | | +-- 001.Black_footed_Albatross
| | | | +-- Black_Footed_Albatross_0001_796111.jpg
| | | | +-- Black_Footed_Albatross_0002_55.jpg
| | | | +-- ...
| | | +-- 002.Laysan_Albatross
| | | | +-- Laysan_Albatross_0001_545.jpg
| | | | +-- ...
| | | +-- ...
| +-- StanfordCars
| | +-- annos
| | | +-- annos_train.txt
| | | +-- annos_test.txt
| | +-- images
| | | +-- 000001.jpg
| | | +-- 000002.jpg
| | | +-- ...
| +-- ...

各标记文件annos_*.txt内每行的格式如下: The format of each line of annotation files annos_*.txt is: <图像文件相对于images目录的路径> <类别索引(从0开始)> <image path relative to the directory images> <category index (index start from 0)>

例如,对于CUB-200-2011数据集,标记文件形如: For example, for CUB-200-2011 dataset, the annotation file is like:

001.Black_footed_Albatross/Black_Footed_Albatross_0001_796111.jpg 0
001.Black_footed_Albatross/Black_Footed_Albatross_0002_55.jpg 0
002.Laysan_Albatross/Laysan_Albatross_0001_545.jpg 1
...

对于StanfordCars数据集,标记文件形如: For StanfordCars dataset, the annotation file is like:

000001.jpg 0
000002.jpg 0
...
kwangabc commented 3 years ago

您好,我又遇到了些问题,我还没有跑完,但下面结果我认为是某个环节出了问题,刚开始的loss都是50 或60多,下面是跑的一些结果,请问我该从哪几个方面改进才能达到准确率85.1%的结果?非常感谢!

stage 1 epoch 4, val_acc: 0.2824. stage 1 epoch 9, val_acc: 0.4802. stage 1 epoch 14, val_acc: 0.6773. stage 1 epoch 19, val_acc: 0.6931. stage 1 epoch 24, val_acc: 0.7085. stage 1 epoch 29, val_acc: 0.7273. stage 1 epoch 34, val_acc: 0.7135. stage 1 epoch 39, val_acc: 0.7276. stage 1 epoch 44, val_acc: 0.7245. stage 1 epoch 49, val_acc: 0.7235. stage 1 epoch 54, val_acc: 0.7213. stage 1 epoch 59, val_acc: 0.7271. stage 2 epoch 4, val_acc: 0.0119. stage 2 epoch 9, val_acc: 0.0185. stage 2 epoch 14, val_acc: 0.0659. stage 2 epoch 19, val_acc: 0.1329. stage 2 epoch 24, val_acc: 0.2268. stage 2 epoch 29, val_acc: 0.3536. stage 2 epoch 34, val_acc: 0.4750.

kwangabc commented 3 years ago

还有一个问题,麻烦作者能够回复一下,我想用用你训练的精度最高的模型来进行初始化,不知道可以吗?

FlyingMoon-GitHub commented 3 years ago

请设置第一阶段的学习率于[0.01, 0.05]的范围,并不启用我自定义的损失函数2、3和4。具体命令如下: Please set the learning rate of the first stage at the range of [0.01, 0.05], and unable the loss function 2, 3 and 4 defined by myself. The command is: python train.py --dataset=CUB-200-2011 --class_num=200 --lr_1=0.01 --lambda_2=0 --lambda_3=0 --lambda_4=0

FlyingMoon-GitHub commented 3 years ago

因为本人在尝试做改进工作,抱歉我目前可能不便提供模型参数文件。 Since I'm trying to improve the model, I'm sorry that it's probably not convenient for me to provide the checkpoint file of model parameters at the present.

kwangabc commented 3 years ago

因为本人在尝试做改进工作,抱歉我目前可能不便提供模型参数文件。 Since I'm trying to improve the model, I'm sorry that it's probably not convenient for me to provide the checkpoint file of model parameters at the present. 理解,非常感谢您的帮助!!,预祝一切顺利

kwangabc commented 3 years ago

请设置第一阶段的学习率于[0.01, 0.05]的范围,并不启用我自定义的损失函数2、3和4。具体命令如下: Please set the learning rate of the first stage at the range of [0.01, 0.05], and unable the loss function 2, 3 and 4 defined by myself. The command is: `python train.py --dataset=CUB-200-2011 --class_num=200 --lr_1=0.01 --lambda_2=0 --lambda_3=0 --lambda_4=0

作者,您好,我现在对这个命令有点疑惑:

  1. 这个命令是只对第一阶段的--lambda_2=0 --lambda_3=0 --lambda_4=0还是对两个阶段 --lambda_2=0 --lambda_3=0 --lambda_4=0?总感觉命令行的设置会对训练的整个过程都起到影响。
  2. 我并没有看原论文中提供的代码,如果原论文也是这个训练思路的话,是不是表示第二阶段新增加的损失是对第一个阶段训练的一个防止过拟合的措施?
lilihb commented 3 years ago

作者你好,可以说一下你效果最好的模型的学习率等参数设置吗

lkyqyy commented 3 years ago

n您好,我现在想复现一下您的代码,但我遇到了数据集处理的问题,请问您的数据集是怎么设置的?非常感谢!

我请教一下,就是我按照上面说的准备好了数据格式,在运行的dataset.py的时候,会报错,路径不对。FileNotFoundError: [Errno 2] No such file or directory: './data/CUB-200-2011/annos/annos_train.txt'请问一下,你遇到这种情况了嘛

FlyingMoon-GitHub commented 3 years ago

@jdbdnck,请问你把整理好的数据置于了哪个目录下? @jdbdnck, which directory did you place your organized data in?

lkyqyy commented 3 years ago

@jdbdnck,请问你把整理好的数据置于了哪个目录下? @jdbdnck, which directory did you place your organized data in?

我就是放在了您那个已经存在的data目录下的

FlyingMoon-GitHub commented 3 years ago

请设置第一阶段的学习率于[0.01, 0.05]的范围,并不启用我自定义的损失函数2、3和4。具体命令如下: Please set the learning rate of the first stage at the range of [0.01, 0.05], and unable the loss function 2, 3 and 4 defined by myself. The command is: `python train.py --dataset=CUB-200-2011 --class_num=200 --lr_1=0.01 --lambda_2=0 --lambda_3=0 --lambda_4=0

作者,您好,我现在对这个命令有点疑惑:

  1. 这个命令是只对第一阶段的--lambda_2=0 --lambda_3=0 --lambda_4=0还是对两个阶段 --lambda_2=0 --lambda_3=0 --lambda_4=0?总感觉命令行的设置会对训练的整个过程都起到影响。
  2. 我并没有看原论文中提供的代码,如果原论文也是这个训练思路的话,是不是表示第二阶段新增加的损失是对第一个阶段训练的一个防止过拟合的措施?

两个阶段的损失函数是相同的。另外,损失函数2、3和4是由我定义的,原文中并未出现。 The loss functions in two stages are the same. Besides, loss functions 2, 3 and 4 are defined by myself, which didn't appear in the original paper.

FlyingMoon-GitHub commented 3 years ago

建议打印一下os.getcwd()来查看当前工作路径。 I suggest looking up your current working directory by printing os.getcwd().

lkyqyy commented 3 years ago

建议打印一下os.getcwd()来查看当前工作路径。 I suggest looking up your current working directory by printing os.getcwd().

那当前工作路径应该是在哪里呢?是在我所打开的ACNet_master项目之下嘛?还是在data目录之下呢。我查看了一下,当前路径是在我打开的acnet这个项目之下:当前工作目录: E:\新建文件夹\ACNet-master

FlyingMoon-GitHub commented 3 years ago

当前工作路径应是项目根目录。如果运行dataset.py,可以将第52行的args.root_path改为os.join('.', 'data')。 The current working directory should be the root directory of your project. When running dataset.py, you may change args.root_path to os.join('.', 'data') at the line 52.