Giter VIP home page Giter VIP logo

lartpang / minet Goto Github PK

View Code? Open in Web Editor NEW
236.0 10.0 29.0 974 KB

CVPR2020, Multi-scale Interactive Network for Salient Object Detection

Home Page: https://openaccess.thecvf.com/content_CVPR_2020/html/Pang_Multi-Scale_Interactive_Network_for_Salient_Object_Detection_CVPR_2020_paper.html

License: MIT License

Python 100.00%
multi-scale-features paper experimental pretrained-parameters saliency saliency-detection saliency-maps saliency-map saliency-model salient-object-detection cvpr2020 paper-details

minet's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minet's Issues

关于指标的一些疑问。

作者您好,我下载了您的saliency map(resnet50的),并用F3Net提供的evaluation code进行了测试,目前只是测了DUTS-TS这一个数据集。但是,我发现您提供的结果在DUTS-TE上的E-measure上的分数是0.8983(论文中展示的是0.917),不知道是否是操作系统环境导致的问题?我进一步检查了您在DUTS-TE上其他对比方法的结果(均从作者的github上直接下载),BASNet(本地0.8843,您的论文中0.884,没有出入),CPD-R(本地0.8874,您的论文中显示0.904,F3Net论文中0.886)。
我猜测是因为每篇论文测试代码有些微的不同导致了上述的差异,可能操作系统等环境也会导致一些差异,那么,我有一个问题想向您请教一些,面对这样的情况(测试结果与论文结果由较大出入时),是应该统一使用作者提供的结果并使用同样evaluation code进行测试,还是必须要引用论文结果才可以呢?

Error trying to test trained model

Hello,

i want to try out on of your trained models on the ESCCD Dataset. I have been trying to follow your readme as close as possible and tried very carefully to do so exactly as you describe but it still fails and I just can't figure it out.

My Config file looks like this:

# -*- coding: utf-8 -*-
import os

__all__ = ["proj_root", "arg_config"]

from collections import OrderedDict

proj_root = os.path.dirname(__file__)
datasets_root = "./Dataset/"

ecssd_path = os.path.join(datasets_root, "ESCCD/")

arg_config = {
    "model": "MINet_Res50",  # 实际使用的模型,需要在`network/__init__.py`中导入
    "info": "",  # 关于本次实验的额外信息说明,这个会附加到本次试验的exp_name的结尾,如果为空,则不会附加内容。
    "use_amp": False,  # 是否使用amp加速训练
    "resume_mode": "test",  # the mode for resume parameters: ['train', 'test', '']
    "use_aux_loss": True,  # 是否使用辅助损失
    "save_pre": True,  # 是否保留最终的预测结果
    "epoch_num": 0,  # 训练周期, 0: directly test model
    "lr": 0.001,  # 微调时缩小100倍
    "xlsx_name": "result.xlsx",  # the name of the record file
    # 数据集设置
    "rgb_data": {
        "tr_data_path": ecssd_path,
        "te_data_list": OrderedDict(
            {
                "ecssd": ecssd_path,
            },
        ),
    },
    # 训练过程中的监控信息
    "tb_update": 50,  # >0 则使用tensorboard
    "print_freq": 50,  # >0, 保存迭代过程中的信息
    # img_prefix, gt_prefix,用在使用索引文件的时候的对应的扩展名
    "prefix": (".jpg", ".png"),
    # if you dont use the multi-scale training, you can set 'size_list': None
    # "size_list": [224, 256, 288, 320, 352],
    "size_list": None,  # 不使用多尺度训练
    "reduction": "mean",  # 损失处理的方式,可选“mean”和“sum”
    # 优化器与学习率衰减
    "optim": "sgd_trick",  # 自定义部分的学习率
    "weight_decay": 5e-4,  # 微调时设置为0.0001
    "momentum": 0.9,
    "nesterov": False,
    "sche_usebatch": False,
    "lr_type": "poly",
    "warmup_epoch": 1,  # depond on the special lr_type, only lr_type has 'warmup', when set it to 1, it means no warmup.
    "lr_decay": 0.9,  # poly
    "use_bigt": True,  # 训练时是否对真值二值化(阈值为0.5)
    "batch_size": 4,  # 要是继续训练, 最好使用相同的batchsize
    "num_workers": 4,  # 不要太大, 不然运行多个程序同时训练的时候, 会造成数据读入速度受影响
    "input_size": 320,
}

It seems to successfully load the Data and the model, at least the console output says as much.
But on line 250 in the solver.py:
tqdm_iter = tqdm(enumerate(loader), total=len(loader), leave=False)
It fails, we can trace the error further into the dataloader.py, where it throws when trying to return a BackgroundGenerator:

class DataLoaderX(DataLoader):
    def __iter__(self):
        return BackgroundGenerator(super(DataLoaderX, self).__iter__())

This is the whole Log:
When I start the main.py, the following gets printed:

C:\Users\Seppi\Desktop\MINet-master\code>python main.py
 ==============>> 2021-04-30 17:47:57.367696: Initializing... <<==============
 =========>> Project Root: C:\Users\Seppi\Desktop\MINet-master\code <<=========
 ============>> We will not use `torch.backends.cudnn.benchmark` <<============
 =====================>> Training on: ./Dataset/ESCCD/ <<=====================
 ========>> ./Dataset/ESCCD/ is an image folder, we will test on it. <<========
{'batch_size': 4,
 'epoch_num': 0,
 'info': '',
 'input_size': 320,
 'lr': 0.001,
 'lr_decay': 0.9,
 'lr_type': 'poly',
 'model': 'MINet_Res50',
 'momentum': 0.9,
 'nesterov': False,
 'num_workers': 4,
 'optim': 'sgd_trick',
 'prefix': ('.jpg', '.png'),
 'print_freq': 50,
 'reduction': 'mean',
 'resume_mode': 'test',
 'rgb_data': {'te_data_list': OrderedDict([('ecssd', './Dataset/ESCCD/')]),
              'tr_data_path': './Dataset/ESCCD/'},
 'save_pre': True,
 'sche_usebatch': False,
 'size_list': None,
 'tb_update': 50,
 'use_amp': False,
 'use_aux_loss': True,
 'use_bigt': True,
 'warmup_epoch': 1,
 'weight_decay': 0.0005,
 'xlsx_name': 'result.xlsx'}
 ==>> Loading checkpoint 'C:\Users\Seppi\Desktop\MINet-master\code\output\MINet_Res50_S320_BS4_E0_WE1_AMPn_LR0.001_LTpoly_OTsgdtrick_ALy_BIy_MSn\pth\state_final.pth' <<==
 ==>> Loaded checkpoint 'C:\Users\Seppi\Desktop\MINet-master\code\output\MINet_Res50_S320_BS4_E0_WE1_AMPn_LR0.001_LTpoly_OTsgdtrick_ALy_BIy_MSn\pth\state_final.pth' (only has the model's weight params) <<==
 ================>> Total initialization time:0:00:03.281000 <<================
 ==================>> 2021-04-30 17:48:00.650699: Start... <<==================
 ======================>> Testing with testset: ecssd <<======================
 ======================>> Testing on: ./Dataset/ESCCD/ <<======================
 ========>> ./Dataset/ESCCD/ is an image folder, we will test on it. <<========
 ==============>> 2021-04-30 17:48:01.648697: Initializing... <<==============
 =========>> Project Root: C:\Users\Seppi\Desktop\MINet-master\code <<=========
 ============>> We will not use `torch.backends.cudnn.benchmark` <<============
 =====================>> Training on: ./Dataset/ESCCD/ <<=====================
 ========>> ./Dataset/ESCCD/ is an image folder, we will test on it. <<========
{'batch_size': 4,
 'epoch_num': 0,
 'info': '',
 'input_size': 320,
 'lr': 0.001,
 'lr_decay': 0.9,
 'lr_type': 'poly',
 'model': 'MINet_Res50',
 'momentum': 0.9,
 'nesterov': False,
 'num_workers': 4,
 'optim': 'sgd_trick',
 'prefix': ('.jpg', '.png'),
 'print_freq': 50,
 'reduction': 'mean',
 'resume_mode': 'test',
 'rgb_data': {'te_data_list': OrderedDict([('ecssd', './Dataset/ESCCD/')]),
              'tr_data_path': './Dataset/ESCCD/'},
 'save_pre': True,
 'sche_usebatch': False,
 'size_list': None,
 'tb_update': 50,
 'use_amp': False,
 'use_aux_loss': True,
 'use_bigt': True,
 'warmup_epoch': 1,
 'weight_decay': 0.0005,
 'xlsx_name': 'result.xlsx'}
 ==>> Loading checkpoint 'C:\Users\Seppi\Desktop\MINet-master\code\output\MINet_Res50_S320_BS4_E0_WE1_AMPn_LR0.001_LTpoly_OTsgdtrick_ALy_BIy_MSn\pth\state_final.pth' <<==
 ==>> Loaded checkpoint 'C:\Users\Seppi\Desktop\MINet-master\code\output\MINet_Res50_S320_BS4_E0_WE1_AMPn_LR0.001_LTpoly_OTsgdtrick_ALy_BIy_MSn\pth\state_final.pth' (only has the model's weight params) <<==
 ================>> Total initialization time:0:00:03.193000 <<================
 ==================>> 2021-04-30 17:48:04.844698: Start... <<==================
 ======================>> Testing with testset: ecssd <<======================
 ======================>> Testing on: ./Dataset/ESCCD/ <<======================
 ========>> ./Dataset/ESCCD/ is an image folder, we will test on it. <<========
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Seppi\Desktop\MINet-master\code\main.py", line 36, in <module>
    solver.test()
  File "C:\Users\Seppi\Desktop\MINet-master\code\utils\solver.py", line 229, in test
    results = self._test_process(save_pre=self.save_pre)
  File "C:\Users\Seppi\Desktop\MINet-master\code\utils\solver.py", line 250, in _test_process
    tqdm_iter = tqdm(enumerate(loader), total=len(loader), leave=False)
  File "C:\Users\Seppi\Desktop\MINet-master\code\utils\dataloader.py", line 153, in __iter__
    return BackgroundGenerator(super(DataLoaderX, self).__iter__())
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\utils\data\dataloader.py", line 352, in __iter__
    return self._get_iterator()
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\utils\data\dataloader.py", line 294, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\utils\data\dataloader.py", line 801, in __init__
    w.start()
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 327, in _Popen
    return Popen(process_obj)
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\Seppi\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.


I am running Windows 10 with Cuda 10.1, Python 3.8.6 and I believe Torch 1.7.1 or something

Some question about PASCAL-S.

您好,现有的模型所提供的结果PASCAL-S上进行测试时,AUC和MaxF往往都是NAN,但是我看的您的论文中MAXF是0.882,请问您是怎么得到这个结果的(我在别的Project中看的有人是直接剔除了没有显著目标的图片,有人则认为应该在完整数据集上进行测试)?(注:我使用的evaluate code就是您提供的那份)

DataSet Split

您好,请问您如何对PASCAL-S,HKU-IS等数据集是如何划分训练集和测试集的呢?我找到的这些数据集,除了DUTS其他的都没有对测试集进行划分。

how do you calculate the inference time

Hi, thanks for your great work, I'm curious how do you calculate your inference time, when I'm running a single image on a Tesla V100 using your minet demo, it's far from reaching 86fps.
And I also calculate your minet-res50's FLOPs and params, 162.38G and 87.06M, they are so big, how can it run so fast in your paper?

Keras

Hey!

Could you please upload the model to be used with keras?

Why raise NotImplementedError from create_rgb_datasets_imgs.py?

Traceback (most recent call last):
File "main.py", line 18, in
solver = Solver(arg_config, path_config)
File "/userhome/MINet/code/utils/solver.py", line 57, in init
mode="train",
File "/userhome/MINet/code/utils/imgs/create_loader_imgs.py", line 84, in create_loader
use_bigt=arg_config["use_bigt"],
File "/userhome/MINet/code/utils/imgs/create_rgb_datasets_imgs.py", line 140, in init
raise NotImplementedError
NotImplementedError

TODO List

  • Use the amp of pytorch for AMP.
  • Fix some mistakes in the readme.md
  • Add a simpler version.

How does WSGN improve the generalization performance of the model

Hi, thanks for your great work, I have trained the model using CPLMINet_WSGNRes50 network on other datasets, and found it really improves the generalization performance on the evaluation score compared to origin MINet network .

I'm curious is WSGN only change the backbone from the origin MINet network, or is there anything I have missed, and wonder know is it the main reason to improve generalization performance of the model?

pascal-s数据集指标问题

你好,我使用你提供的指标测试代码在5个数据集上进行了验证,发现除了pascal-s以外的四个数据集指标均能和论文中上报的指标一致,我也剔除了pascal-s数据集中的5张图片,发现依旧对不上论文中的指标。不知是哪里出现问题导致不一致。

is there 2 images missing in DUTS-TE?

the provided results on DUTS-TE only contain 5017 images, while the dataset contains 5019 images.
'ILSVRC2012_test_00036002.png' and 'sun_bcogaqperiljqupq.png'.

Some Error

This is an inspiring work, but when I try to train without any modify, I meet some trouble:
[I:1279/131900][E:0:50]>[MINet_VGG16_e_40_lr_0.025_opti_f3trick_sche_Poly][Lr:0.0001000,0.0010000][Avg:0.40408|Cur:0.38437|['0.19423', '0.19013']]
Exception in thread Thread-3:
Traceback (most recent call last):
File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/prefetch_generator/init.py", line 80, in run
for item in self.generator:
File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in next
return self._process_data(data)
File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data
data.reraise()
File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/_utils.py", line 385, in reraise
raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in DataLoader worker process 2.
Original Traceback (most recent call last):
File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
return self.collate_fn(data)
File "/data/SOD/MINet/code/utils/imgs/create_loader_imgs.py", line 24, in _collate_fn
mask = torch.stack(mask, dim=0)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 4 and 1 in dimension 1 at /tmp/pip-req-build-vxpey3tb/aten/src/TH/generic/THTensor.cpp:689

Eq. 6 in paper

what does the abbrev "sup(g -pg)" stand for in eq. 6? supremum?

thanks
eq6

您好,不需要mask进行检测的版本您还会更新吗?

您在之前的issue提到
“NOTE: Currently, I only released the code to test images which have the paired masks. But it is easy to modify the code in https://github.com/lartpang/MINet/blob/master/code/utils/imgs/create_rgb_datasets_imgs.py and https://github.com/lartpang/MINet/blob/master/code/utils/solver.py to test your images without masks”
请问这个版本还会更新吗,如果不更新,想请您告诉我修改思路,怎么样在无mask下进行检测

matting leaves and flowers

When I go to pick the flowers with leaves, some of the background on the edge of the target cannot be removed. If they are cut off together, the background on the internal space of the target can not be removed. How to solve this problem?
If it can be solved, it is a meaningful thing,thanks for your reply.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.