Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Download Pretrained SSD Model #42

Closed
BahadirGLCK opened this issue Sep 28, 2021 · 3 comments
Closed

Unable to Download Pretrained SSD Model #42

BahadirGLCK opened this issue Sep 28, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@BahadirGLCK
Copy link

When I decided to use the SSD model for this repo. I followed your instructions but the SSD Model is unreachable.
Here is my output:

2021-09-28 19:14:43,252 - mmdet - INFO - Environment info:
------------------------------------------------------------
sys.platform: linux
Python: 3.7.10 | packaged by conda-forge | (default, Sep 13 2021, 19:43:44) [GCC 9.4.0]
CUDA available: True
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 10.0, V10.0.130
GPU 0: Tesla T4
GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
PyTorch: 1.6.0
PyTorch compiling details: PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) oneAPI Math Kernel Library Version 2021.3-Product Build 20210617 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.5.0 (Git Hash e2ac1fac44c5078ca927cb9b90e1b3066a0b2ed0)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 10.2
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
  - CuDNN 7.6.5
  - Magma 2.5.2
  - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF, 

TorchVision: 0.7.0
OpenCV: 4.5.3
MMCV: 1.0.5
MMDetection: 2.3.0+cbed89d
MMDetection Compiler: GCC 7.3
MMDetection CUDA Compiler: 10.2
------------------------------------------------------------

2021-09-28 19:14:43,253 - mmdet - INFO - Distributed training: True
2021-09-28 19:14:44,676 - mmdet - INFO - Config:
input_size = 300
model = dict(
    type='SingleStageDetector',
    pretrained='open-mmlab://vgg16_caffe',
    backbone=dict(
        type='SSDVGG',
        input_size=300,
        depth=16,
        with_last_pool=False,
        ceil_mode=True,
        out_indices=(3, 4),
        out_feature_indices=(22, 34),
        l2_norm_scale=20),
    neck=None,
    bbox_head=dict(
        type='SSDHead',
        in_channels=(512, 1024, 512, 256, 256, 256),
        C=20,
        anchor_generator=dict(
            type='SSDAnchorGenerator',
            scale_major=False,
            input_size=300,
            basesize_ratio_range=(0.2, 0.9),
            strides=[8, 16, 32, 64, 100, 300],
            ratios=[[2], [2, 3], [2, 3], [2, 3], [2], [2]]),
        bbox_coder=dict(
            type='DeltaXYWHBBoxCoder',
            target_means=[0.0, 0.0, 0.0, 0.0],
            target_stds=[0.1, 0.1, 0.2, 0.2])))
cudnn_benchmark = True
train_cfg = dict(
    assigner=dict(
        type='MaxIoUAssigner',
        pos_iou_thr=0.5,
        neg_iou_thr=0.5,
        min_pos_iou=0.0,
        ignore_iof_thr=-1,
        gt_max_assign_all=False),
    smoothl1_beta=1.0,
    allowed_border=-1,
    pos_weight=-1,
    neg_pos_ratio=3,
    debug=False,
    param_lambda=0.5)
test_cfg = dict(
    nms=dict(type='nms', iou_threshold=0.45),
    min_bbox_size=0,
    score_thr=0.02,
    max_per_img=200)
theta_f_1 = [
    'bbox_head.f_1_convs.0.weight', 'bbox_head.f_1_convs.0.bias',
    'bbox_head.f_1_convs.1.weight', 'bbox_head.f_1_convs.1.bias',
    'bbox_head.f_1_convs.2.weight', 'bbox_head.f_1_convs.2.bias',
    'bbox_head.f_1_convs.3.weight', 'bbox_head.f_1_convs.3.bias',
    'bbox_head.f_1_convs.4.weight', 'bbox_head.f_1_convs.4.bias',
    'bbox_head.f_1_convs.5.weight', 'bbox_head.f_1_convs.5.bias'
]
theta_f_2 = [
    'bbox_head.f_2_convs.0.weight', 'bbox_head.f_2_convs.0.bias',
    'bbox_head.f_2_convs.1.weight', 'bbox_head.f_2_convs.1.bias',
    'bbox_head.f_2_convs.2.weight', 'bbox_head.f_2_convs.2.bias',
    'bbox_head.f_2_convs.3.weight', 'bbox_head.f_2_convs.3.bias',
    'bbox_head.f_2_convs.4.weight', 'bbox_head.f_2_convs.4.bias',
    'bbox_head.f_2_convs.5.weight', 'bbox_head.f_2_convs.5.bias'
]
data_root = '/home/ubuntu/bahadir/datasets/VOCdevkit/'
dataset_type = 'VOCDataset'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[1, 1, 1], to_rgb=True)
train_pipeline = [
    dict(type='LoadImageFromFile', to_float32=True),
    dict(type='LoadAnnotations', with_bbox=True),
    dict(
        type='PhotoMetricDistortion',
        brightness_delta=32,
        contrast_range=(0.5, 1.5),
        saturation_range=(0.5, 1.5),
        hue_delta=18),
    dict(
        type='Expand',
        mean=[123.675, 116.28, 103.53],
        to_rgb=True,
        ratio_range=(1, 4)),
    dict(
        type='MinIoURandomCrop',
        min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
        min_crop_size=0.3),
    dict(type='Resize', img_scale=(300, 300), keep_ratio=False),
    dict(
        type='Normalize',
        mean=[123.675, 116.28, 103.53],
        std=[1, 1, 1],
        to_rgb=True),
    dict(type='RandomFlip', flip_ratio=0.5),
    dict(type='DefaultFormatBundle'),
    dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
]
test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(
        type='MultiScaleFlipAug',
        img_scale=(300, 300),
        flip=False,
        transforms=[
            dict(type='Resize', keep_ratio=False),
            dict(
                type='Normalize',
                mean=[123.675, 116.28, 103.53],
                std=[1, 1, 1],
                to_rgb=True),
            dict(type='ImageToTensor', keys=['img']),
            dict(type='Collect', keys=['img'])
        ])
]
data = dict(
    samples_per_gpu=8,
    workers_per_gpu=3,
    train=dict(
        type='RepeatDataset',
        times=1,
        dataset=dict(
            type='VOCDataset',
            ann_file=[
                '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2007/ImageSets/Main/trainval.txt',
                '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2012/ImageSets/Main/trainval.txt'
            ],
            img_prefix=[
                '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2007/',
                '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2012/'
            ],
            pipeline=[
                dict(type='LoadImageFromFile', to_float32=True),
                dict(type='LoadAnnotations', with_bbox=True),
                dict(
                    type='PhotoMetricDistortion',
                    brightness_delta=32,
                    contrast_range=(0.5, 1.5),
                    saturation_range=(0.5, 1.5),
                    hue_delta=18),
                dict(
                    type='Expand',
                    mean=[123.675, 116.28, 103.53],
                    to_rgb=True,
                    ratio_range=(1, 4)),
                dict(
                    type='MinIoURandomCrop',
                    min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
                    min_crop_size=0.3),
                dict(type='Resize', img_scale=(300, 300), keep_ratio=False),
                dict(
                    type='Normalize',
                    mean=[123.675, 116.28, 103.53],
                    std=[1, 1, 1],
                    to_rgb=True),
                dict(type='RandomFlip', flip_ratio=0.5),
                dict(type='DefaultFormatBundle'),
                dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
            ])),
    val=dict(
        type='VOCDataset',
        ann_file=
        '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2007/ImageSets/Main/test.txt',
        img_prefix='/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2007/',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(
                type='MultiScaleFlipAug',
                img_scale=(300, 300),
                flip=False,
                transforms=[
                    dict(type='Resize', keep_ratio=False),
                    dict(
                        type='Normalize',
                        mean=[123.675, 116.28, 103.53],
                        std=[1, 1, 1],
                        to_rgb=True),
                    dict(type='ImageToTensor', keys=['img']),
                    dict(type='Collect', keys=['img'])
                ])
        ]),
    test=dict(
        type='VOCDataset',
        ann_file=[
            '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2007/ImageSets/Main/trainval.txt',
            '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2012/ImageSets/Main/trainval.txt'
        ],
        img_prefix=[
            '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2007/',
            '/home/ubuntu/bahadir/datasets/VOCdevkit/VOC2012/'
        ],
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(
                type='MultiScaleFlipAug',
                img_scale=(300, 300),
                flip=False,
                transforms=[
                    dict(type='Resize', keep_ratio=False),
                    dict(
                        type='Normalize',
                        mean=[123.675, 116.28, 103.53],
                        std=[1, 1, 1],
                        to_rgb=True),
                    dict(type='ImageToTensor', keys=['img']),
                    dict(type='Collect', keys=['img'])
                ])
        ]))
evaluation = dict(interval=5, metric='mAP')
checkpoint_config = dict(interval=1)
log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')])
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
optimizer = dict(type='SGD', lr=0.001, momentum=0.9, weight_decay=0.0005)
optimizer_config = dict()
lr_config = dict(
    policy='step',
    warmup='linear',
    warmup_iters=500,
    warmup_ratio=0.001,
    step=[1])
epoch_ratio = [5, 1]
epoch = 2
X_L_repeat = 16
X_U_repeat = 16
k = 10000
X_S_size = 1000
X_L_0_size = 1000
cycles = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
work_directory = './work_dirs/MI-AOD_SSD'
gpu_ids = range(0, 1)

2021-09-28 19:14:44,676 - mmdet - INFO - Set random seed to 666, deterministic: False
2021-09-28 19:14:44,716 - mmdet - INFO - Set random seed to 666, deterministic: False
2021-09-28 19:14:44,958 - mmdet - INFO - load model from: open-mmlab://vgg16_caffe
Downloading: "https://open-mmlab.s3.ap-northeast-2.amazonaws.com/pretrain/third_party/vgg16_caffe-292e1171.pth" to /home/ubuntu/.cache/torch/hub/checkpoints/vgg16_caffe-292e1171.pth
Traceback (most recent call last):
  File "./tools/train.py", line 257, in <module>
    main()
  File "./tools/train.py", line 131, in main
    model = build_detector(cfg.model, train_cfg=cfg.train_cfg, test_cfg=cfg.test_cfg)
  File "/home/ubuntu/bahadir/MI-AOD-SSD/mmdet/models/builder.py", line 67, in build_detector
    return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg))
  File "/home/ubuntu/bahadir/MI-AOD-SSD/mmdet/models/builder.py", line 32, in build
    return build_from_cfg(cfg, registry, default_args)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/site-packages/mmcv/utils/registry.py", line 167, in build_from_cfg
    return obj_cls(**args)
  File "/home/ubuntu/bahadir/MI-AOD-SSD/mmdet/models/detectors/single_stage.py", line 28, in __init__
    self.init_weights(pretrained=pretrained)
  File "/home/ubuntu/bahadir/MI-AOD-SSD/mmdet/models/detectors/single_stage.py", line 38, in init_weights
    self.backbone.init_weights(pretrained=pretrained)
  File "/home/ubuntu/bahadir/MI-AOD-SSD/mmdet/models/backbones/ssd_vgg.py", line 84, in init_weights
    load_checkpoint(self, pretrained, strict=False, logger=logger)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/site-packages/mmcv/runner/checkpoint.py", line 224, in load_checkpoint
    checkpoint = _load_checkpoint(filename, map_location)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/site-packages/mmcv/runner/checkpoint.py", line 189, in _load_checkpoint
    checkpoint = load_url_dist(model_url)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/site-packages/mmcv/runner/checkpoint.py", line 111, in load_url_dist
    checkpoint = model_zoo.load_url(url, model_dir=model_dir)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/site-packages/torch/hub.py", line 481, in load_state_dict_from_url
    download_url_to_file(url, cached_file, hash_prefix, progress=progress)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/site-packages/torch/hub.py", line 379, in download_url_to_file
    u = urlopen(req)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/site-packages/torch/distributed/launch.py", line 261, in <module>
    main()
  File "/home/ubuntu/anaconda3/envs/miaod/lib/python3.7/site-packages/torch/distributed/launch.py", line 257, in main
    cmd=cmd)
subprocess.CalledProcessError: Command '['/home/ubuntu/anaconda3/envs/miaod/bin/python', '-u', './tools/train.py', '--local_rank=0', 'configs/MIAOD.py', '--launcher', 'pytorch']' returned non-zero exit status 1.
@yuantn
Copy link
Owner

yuantn commented Sep 30, 2021

You can get the updated pretrained model link from the latest version of mmcv.

@Liang-ZX
Copy link

Liang-ZX commented Oct 5, 2021

Excuse me. I would like to know whether your running result of SSD comparable to that in the paper. If so, how do you modify the code? Only the config file? Thanks.

@yuantn
Copy link
Owner

yuantn commented Oct 8, 2021

Excuse me. I would like to know whether your running result of SSD comparable to that in the paper. If so, how do you modify the code? Only the config file? Thanks.

Yes, the performance is comparable to that in the paper.

You just need to replace the configuration file like here.

@yuantn yuantn added the bug Something isn't working label Oct 11, 2021
@yuantn yuantn closed this as completed Oct 30, 2021
yuantn added a commit that referenced this issue Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants