Code Monkey home page Code Monkey logo

sniper's Introduction

SNIPER / AutoFocus: Efficient Multi-Scale Training / Inference

SNIPER is an efficient multi-scale training approach for instance-level recognition tasks like object detection and instance-level segmentation. Instead of processing all pixels in an image pyramid, SNIPER selectively processes context regions around the ground-truth objects (a.k.a chips). This significantly speeds up multi-scale training as it operates on low-resolution chips. Due to its memory-efficient design, SNIPER can benefit from Batch Normalization during training and it makes larger batch-sizes possible for instance-level recognition tasks on a single GPU. Hence, we do not need to synchronize batch-normalization statistics across GPUs and we can train object detectors similar to the way we do image classification!

AutoFocus, on the other hand, is an efficient multi-scale inference algorithm for deep-learning based object detectors. Instead of processing an entire image pyramid, AutoFocus adopts a coarse to fine approach and only processes regions that are likely to contain small objects at finer scales. This is achieved by predicting category agnostic segmentation maps for small objects at coarser scales, called FocusPixels. FocusPixels can be predicted with high recall, and in many cases, they only cover a small fraction of the entire image. To make efficient use of FocusPixels, an algorithm is proposed which generates compact rectangular FocusChips which enclose FocusPixels. The detector is while processing finer scales.

SNIPER is initially described in the following paper published at NeurIPS 2018:

SNIPER: Efficient Multi-Scale Training
Bharat Singh*, Mahyar Najibi*, and Larry S. Davis (* denotes equal contribution)
NeurIPS, 2018.

AutoFocus is initially described in the following paper published at ICCV 2019:

AutoFocus: Efficient Multi-Scale Inference
Mahyar Najibi*, Bharat Singh*, and Larry S. Davis (* denotes equal contribution)
ICCV, 2019.

Features

  1. Train with a batch size of 160 images with a ResNet-101 backbone on 8 V100 GPUs
  2. NO PYTHON LAYERS (Every layer is optimized for large batch sizes in CUDA/C++)
  3. HALF PRECISION TRAINING with no loss in accuracy
  4. 5 Images/second during inference on a single V100 GPU, 47.8/68.2 on COCO using ResNet-101 and without training on segmentation masks
  5. Use the lightweight MobileNetV2 model trained with SNIPER to get 34.3/54.5 on COCO without training on segmentation masks
  6. The R-FCN-3K branch is also powered by SNIPER. Now 21% better than YOLO-9000 on ImageNetDet. This branch also supports on-the-fly training (in seconds) with very few samples (no bounding boxes needed!)
  7. Train on OpenImagesV4 (14x bigger than COCO) with ResNet-101 in 3 days on a p3.x16.large AWS instance!

Results

COCO dataset

Here are the COCO results for SNIPER trained using this repository. The models are trained on the trainval set (using only the bounding box annotations) and evaluated on the test-dev set.

network architecture pre-trained dataset test dataset mAP [email protected] [email protected] mAP@S mAP@M mAP@L
SNIPER ResNet-101 ImageNet test-dev15 46.5 67.5 52.2 30.0 49.4 58.4
SNIPER ResNet-101 OpenImagesV4 test-dev15 47.8 68.2 53.6 31.5 50.4 59.8
SNIPER MobileNetV2 ImageNet test-dev15 34.3 54.4 37.9 18.5 36.9 46.4
AutoFocus ResNet-101 OpenImagesV4 val-2017 47.5 67.7 53.2 33.3 51.2 60.8

You can download the OpenImages pre-trained model by running bash scripts/download_pretrained_models.sh. The SNIPER detectors trained on both COCO (ResNet-101 and MobileNetV2) and PASCAL VOC datasets and the AutoFocus model trained on the COCO dataset (ResNet-101) can be downloaded by running bash scripts/download_sniper_autofocus_detectors.sh.

License

SNIPER is released under Apache license. See LICENSE for details.

Citing

@article{najibi2019autofocus,
  title={{AutoFocus}: Efficient Multi-Scale Inference},
  author={Najibi, Mahyar and Singh, Bharat and Davis, Larry S},
  journal={ICCV},
  year={2019}
}
@article{sniper2018,
  title={{SNIPER}: Efficient Multi-Scale Training},
  author={Singh, Bharat and Najibi, Mahyar and Davis, Larry S},
  journal={NeurIPS},
  year={2018}
}
@article{analysissnip2017,
  title={An analysis of scale invariance in object detection-snip},
  author={Singh, Bharat and Davis, Larry S},
  journal={CVPR},
  year={2018}
}

Contents

  1. Installation
  2. Running the demo
  3. Training a model with SNIPER / AutoFocus
  4. Evaluting SNIPER / AutoFocus models
  5. Other methods and branches in this repo (SSH Face Detector, R-FCN-3K, open-images)

Installation

  1. Clone the repository:
git clone --recursive https://github.com/mahyarnajibi/SNIPER.git
  1. Compile the provided MXNet fork in the repository.

You need to install CUDA, CuDNN, OpenCV, and OpenBLAS. These libraries are set to be used by default in the provided config.mk file in the SNIPER-mxnet repository. You can use the make command to build the MXNet library:

cd SNIPER-mxnet
make -j [NUM_OF_PROCESS] USE_CUDA_PATH=[PATH_TO_THE_CUDA_FOLDER]

If you plan to train models on multiple GPUs, it is optional but recommended to install NCCL and build MXNet with the NCCL support as instructed below:

make -j [NUM_OF_PROCESS] USE_CUDA_PATH=[PATH_TO_THE_CUDA_FOLDER] USE_NCCL=1 

In this case, you may also need to set the USE_NCCL_PATH variable in the above command to point to your NCCL installation path.

If you need more information on how to compile MXNet please see here.

  1. Compile the C++ files in the lib directory. The following script compiles them all:
bash scripts/compile.sh
  1. Install the required python packages:
pip install -r requirements.txt

Running the demo

For running the demo, you need to download the provided SNIPER models. The following script downloads SNIPER models and extracts them into the default location:

bash download_sniper_autofocus_detectors.sh

After downloading the model, the following command would run the SNIPER detector trained on the COCO dataset with the default configs on the provided sample image:

python demo.py

If everything goes well, the sample detections would be saved as data/demo/demo_detections.jpg.

You can also run the detector on an arbitrary image by providing its path to the script:

python demo.py --im_path [PATH to the image]

However, if you plan to run the detector on multiple images, please consider using the provided multi-process and multi-batch main_test module.

You can also test the provided SNIPER model based on the MobileNetV2 architecture trained on the COCO dataset by passing the provided config file as follows:

python demo.py --cfg configs/faster/sniper_mobilenetv2_e2e.yml

Training a model with SNIPER / AutoFocus

For training SNIPER/AutoFocus, you first need to download the pre-trained models and configure the datasets as described below.

Downloading pre-trained models

Running the following script downloads and extracts the pre-trained models into the default path (data/pretrained_model):

bash download_pretrained_models.sh
Configuring the dataset
COCO dataset:

Please follow the official COCO dataset website to download the dataset. After downloading the dataset you should have the following directory structure:

data
  |--coco
      |--annotations
      |--images
PASCAL VOC dataset:

Please download the training, validation, and test subsets from the [official Pascal VOC dataset website (http://host.robots.ox.ac.uk/pascal/VOC/). After downloading the dataset you should have the following directory structure:

data
  |--VOCdevkit
      |--VOC2007
      |--VOC2012
Training the SNIPER detector

You can train the SNIPER detector with or without negative chip mining as described below.

Training with Negative Chip Mining:

Negative chip mining results in a relative improvement in AP (please refer to the paper for the details). To determine the candidate hard negative regions, SNIPER uses proposals extracted from a proposal network trained for a short training schedule.

For COCO and Pascal VOC datasets, we provide the pre-computed proposals. The following commands download the pre-computed proposals, extracts them into the default path (data/proposals), and trains the SNIPER detector with the default parameters on the COCO dataset:

bash download_sniper_neg_props.sh
python main_train.py

For training on Pascal VOC with the provided pre-computed proposals, you can run python main_train.py --cfg configs/faster/sniper_res101_e2e_pascal_voc.yml.

However, it is also possible to extract the required proposals using this repository (e.g. if you plan to train SNIPER on a new dataset). We provided an all-in-one script that performs all the required steps for training SNIPER with Negative Chip Mining. Running the following script trains a proposal network for a short cycle (i.e. 2 epochs), extract the proposals, and train the SNIPER detector with Negative Chip Mining:

bash train_neg_props_and_sniper.sh --cfg [PATH_TO_CFG_FILE]
Training without Negative Chip Mining:

You can disable the negative chip mining by setting the TRAIN.USE_NEG_CHIPS to False. This is useful if you plan to try SNIPER on a new dataset or want to shorten the training cycle. In this case, the training can be started by calling the following command:

python main_train.py --set TRAIN.USE_NEG_CHIPS False

In any case, the default training settings can be overwritten by passing a configuration file (see the configs folder for example configuration files). The path to the configuration file can be passed as an argument to the above script using the --cfg flag. It is also possible to set individual configuration key-values by passing --set as the last argument to the module followed by the desired key-values (i.e. --set key1 value1 key2 value2 ...).

Please note that the default config files have the same settings used to train the released models. If you are using a GPU with less amount of memory, please consider reducing the training batch size (by setting TRAIN.BATCH_IMAGES in the config file or passing --set TRAIN.BATCH_IMAGES [DISIRED_VALUE] as the last argument to the module). Also, multi-processing is used to process the data. For smaller amounts of memory, you may need to reduce the number of processes and number of threads according to your system (by setting TRAIN.NUM_PROCESS and TRAIN.NUM_THREAD respectively).

Training the SNIPER detector with AutoFocus

For training SNIPER with the AutoFocus FocusPixel prediction branch, you can pass the AutoFocus config files (e.g. configs/faster/sniper_res101_e2e_autofocus.yml and configs/faster/sniper_res101_e2e_mask_autofocus.yml) to the main_train.py script. The default AutoFocus training hyper-parameters (for defining positive, negative, or don't care FocusPixels) can be modified through the config files. Please refer to the paper for more details.

Evaluting SNIPER / AutoFocus models

Evaluating the provided SNIPER models

The repository provides a set of pre-trained SNIPER models which can be downloaded by running the following script:

bash download_sniper_detector.sh

This script downloads the model weights and extracts them into the expected directory. To evaluate these models on COCO test-dev with the default configuration, you can run the following script:

python main_test.py

For performing inference with AutoFocus, you can run the main_test.py script by passing the AutoFocus config file:

python main_test.py --cfg sniper_res101_e2e_mask_autofocus.py

It is possible to modify the AutoFocus default hyper-parameters through the config file to control the speed-accuracy tradeoff. Please see the paper for more details.

If inference is performed on the COCO test-dev set, a json file containing the detections on the test-dev is produced which can be zipped and uploaded to the COCO evaluation server.

The default SNIPER settings can be also overwritten by passing the path to a configuration file with the --cfg flag (See the configs folder for examples). It is also possible to set individual configuration key-values by passing --set as the last argument to the module followed by the desired key-values (i.e. --set key1 value1 key2 value2 ...).

As an example, for evaluating the provided PASCAL VOC pre-trained model on the VOC 2007 test-set you can pass the provided PASCAL config file to the script:

python main_test.py --cfg configs/faster/sniper_res101_e2e_pascal_voc.yml

Please note that the evaluation is performed in a multi-image per batch and parallel model forward setting. In case of lower GPU memory, please consider reducing the batch size for different scales (by setting TEST.BATCH_IMAGES) or reducing the number of parallel jobs (by setting TEST.CONCURRENT_JOBS in the config file).

Evaluating a model trained with this repository

For evaluating a model trained with this repository, you can run the following script by passing the same configuration file used during the training. The test settings can be set by updating the TEST section of the configuration file (See the configs folder for examples).

python main_test.py --cfg [PATH TO THE CONFIG FILE USED FOR TRAINING]

Branches in this repo (SSH Face Detector, R-FCN-3K, Soft Sampling)

R-FCN-3K

This repo also contains the R-FCN-3k detector.

Please switch to the R-FCN-3k branch for specific instructions.

OpenImagesV4 with Soft Sampling

This repo also contains modules to train on the open-images dataset. Please switch to the openimages2 branch for specific instructions. The detector on OpenImagesV4 was trained with Soft Sampling.

SSH Face Detector

The SSH face detector would be added to this repository soon. In the meanwhile, you can use the code available at the original SSH repository.

sniper's People

Contributors

bharatpublic avatar bharatsingh430 avatar flishwang avatar henrylee2570 avatar mahyarnajibi avatar tdiekel avatar

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  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

sniper's Issues

How did you do the bbox ensemble ?

Hi,

Thank you for your repo and paper. This is an awesome work!

I want to ask that in your paper An Analysis of Scale Invariance in Object Detection – SNIP

You mentioned an ensemble operation. You said that:

Since proposals are shared across all networks, we
average the scores and box-predictions for each RoI. During
flipping we average the detection scores and bounding
box predictions.

How to average box predictions for each RoI?

How did you implemented in your code?

Thank you!

demo.py can't run,and the main_train.py not response.

HI.
Thinks for provide this nice project.
When I compile this repo,I met some problems, and I solve it with compile OpenBLAS and lapcak,link lapack/liblapack.a to /usr/lib/liblapack.a. And then,i run the demo.py,But it not response after print two line 'aaa' and no any other message.Then i change the default config to fit my double 1080ti GPU.I just change the gpus from '0,1,2,3,4,5,6,7' to '0,1',and change the lr from '0.015' to '0.04'.Download pretrained_model and proposals,run the main_train.py script.But the process exhaust all my 32G memory and the computer not responsed.I don't know how to solve this problem.
Env: ubuntu 16.04.04 (kernel 4.4), CUDA9.0/cudnn 7.1.4, double Nvidia 1080 ti,python 2.7
Can you give me some abvise.

KeyError: 'area'

Traceback (most recent call last):
File "main_train.py", line 64, in
for image_set in image_sets]
File "lib/data_utils/load_data.py", line 29, in load_proposal_roidb
roidb = imdb.gt_roidb()
File "lib/dataset/coco.py", line 135, in gt_roidb
roientry,flag = self._load_coco_annotation(index)
File "lib/dataset/coco.py", line 192, in _load_coco_annotation
if obj['area'] > 0 and x2 >= x1 and y2 >= y1:
KeyError: 'area'

Who have met the same question?Please help me, thanks!!

ms < (self.chip_size - self.chip_stride - 1) / im_scale ?

Hi;
I noticed ms < (self.chip_size - self.chip_stride - 1) / im_scale is served as a constraint to choose the valid gt_boxes id(please see below), which however is unmentioned in you paper. Could you please explain the idea behind this constraint? Thank you!

            elif i == 0:
                # The finest scale (but not the only scale)
                ids = np.where((area < self.valid_ranges[i][1]) &
                               (ms < (self.chip_size - self.chip_stride - 1) / im_scale) & (ws >= 2) & (hs >= 2))[0]
            else:
                # An intermediate scale
                ids = np.where((area >= self.valid_ranges[i][0]) & (area < self.valid_ranges[i][1])
                       & (ms < (self.chip_size - self.chip_stride - 1) / im_scale))[0]

Index out of bound error

Hi, I got an index out of bound error when training my own model.

loading annotations into memory...
Done (t=0.35s)
creating index...
index created!
num_images 11500
COCO_train2014 gt roidb loaded from ./data/cache/COCO_train2014_gt_roidb.pkl
appending ground truth annotations
Reading cached proposals after NMS* from data/proposals/COCO_train2014_rpn_after_nms.pkl
Done!
append flipped images to roidb
filtered 7928 roidb entries: 23000 -> 15072
add bounding box regression targets
bbox target means:
[[0. 0. 0. 0.]
[0. 0. 0. 0.]]
[0. 0. 0. 0.]
bbox target stdevs:
[[0.1 0.1 0.2 0.2]
[0.1 0.1 0.2 0.2]]
[0.1 0.1 0.2 0.2]
Creating Iterator with 15072 Images
Total number of extracted chips: 72201
Done!
The Iterator has 72201 samples!
Initializing the model...
Optimizer params: {'wd': 0.01, 'lr_scheduler': <train_utils.lr_scheduler.WarmupMultiBatchScheduler object at 0x7fee7fce4610>, 'multi_precision': True, 'learning_rate': 0.00015, 'rescale_grad': 1.0, 'clip_gradient': None, 'momentum': 0.9}
aaa
[00:32:22] src/operator/nn/./cudnn/./cudnn_algoreg-inl.h:107: Running performance tests to find the best convolution algorithm, this can take a while... (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable)
Exception in thread Thread-8:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "lib/iterators/PrefetchingIter.py", line 61, in prefetch_func
self.next_batch[i] = self.iters[i].next()
File "lib/iterators/MNIteratorBase.py", line 90, in next
if self.iter_next():
File "lib/iterators/MNIteratorBase.py", line 87, in iter_next
return self.get_batch()
File "lib/iterators/MNIteratorE2E.py", line 99, in get_batch
self.batch = self._get_batch()
File "lib/iterators/MNIteratorE2E.py", line 136, in _get_batch
nids = processed_roidb[i]['props_in_chips'][cropid]
IndexError: index 12 is out of bounds for axis 0 with size 12

How can I fix this?

README typo

The first line of the README contains one typo: "instance-level segmentataion" instead of "segmentation"

Cannot cast ufunc subtract output from ...

Hi, I got a problem which really confused me for several days, and I cannot solve. If you may help, that will be great.
The error message shows bellow:

loading annotations into memory...
Done (t=4.05s)
creating index...
index created!
num_images 40504
COCO_val2014 gt roidb loaded from ./data/cache/COCO_val2014_gt_roidb.pkl
filtered 367 roidb entries: 40504 -> 40137
add bounding box regression targets
bbox target means:
[[0. 0. 0. 0.]
 [0. 0. 0. 0.]]
[0. 0. 0. 0.]
bbox target stdevs:
[[0.1 0.1 0.2 0.2]
 [0.1 0.1 0.2 0.2]]
[0.1 0.1 0.2 0.2]
Creating Iterator with 40137 Images
Total number of extracted chips: 155974
Done!
Traceback (most recent call last):
  File "/home/arias/Projects/Python/SNIPER/main_train.py", line 74, in <module>
    threads=config.TRAIN.NUM_THREAD, pad_rois_to=400)
  File "lib/iterators/MNIteratorE2E.py", line 31, in __init__
    super(MNIteratorE2E, self).__init__(roidb, config, batch_size, threads, nGPUs, pad_rois_to, False)
  File "lib/iterators/MNIteratorBase.py", line 33, in __init__
    self.get_batch()
  File "lib/iterators/MNIteratorE2E.py", line 99, in get_batch
    self.batch = self._get_batch()
  File "lib/iterators/MNIteratorE2E.py", line 171, in _get_batch
    all_labels = self.pool.map(self.anchor_worker.worker, worker_data)
  File "/home/arias/anaconda3/envs/python2/lib/python2.7/multiprocessing/pool.py", line 253, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/home/arias/anaconda3/envs/python2/lib/python2.7/multiprocessing/pool.py", line 572, in get
    raise self._value
TypeError: Cannot cast ufunc subtract output from dtype('float64') to dtype('uint16') with casting rule 'same_kind'

Check failed: err == cudaSuccess (7 vs. 0) Name: BatchNormalizationUpdateOutput ErrStr:too many resources requested for launch

Hi, @mahyarnajibi ,, I am new to mxnet and when I run the command,:python demo.py. it turns out:
mxnet.base.MXNetError: [15:56:34] /home/chase/SNIPER/SNIPER-mxnet/src/operator/nn/batch_norm.cu:527: Check failed: err == cudaSuccess (7 vs. 0) Name: BatchNormalizationUpdateOutput ErrStr:too many resources requested for launch

Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/libmxnet.so(dmlc::StackTraceabi:cxx11+0x1bc) [0x7f8cdb156b5c]
[bt] (1) /usr/local/lib/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x28) [0x7f8cdb157f08]
[bt] (2) /usr/local/lib/libmxnet.so(void mxnet::op::BatchNormForwardImpl<mshadow::gpu, mshadow::half::half_t, float>(mshadow::Streammshadow::gpu, mxnet::OpContext const&, mxnet::op::BatchNormParam const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::OpReqType, std::allocatormxnet::OpReqType > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&)+0x31e) [0x7f8cdcd2a05e]
[bt] (3) /usr/local/lib/libmxnet.so(void mxnet::op::BatchNormForward<mshadow::gpu, mshadow::half::half_t, float>(mxnet::OpContext const&, mxnet::op::BatchNormParam const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::OpReqType, std::allocatormxnet::OpReqType > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&)+0x301) [0x7f8cdcd2a841]
[bt] (4) /usr/local/lib/libmxnet.so(void mxnet::op::BatchNormComputemshadow::gpu(nnvm::NodeAttrs const&, mxnet::OpContext const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::OpReqType, std::allocatormxnet::OpReqType > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&)+0x852) [0x7f8cdcd1fcc2]
[bt] (5) /usr/local/lib/libmxnet.so(mxnet::exec::FComputeExecutor::Run(mxnet::RunContext, bool)+0x50) [0x7f8cdb2a0660]
[bt] (6) /usr/local/lib/libmxnet.so(+0xc55ba8) [0x7f8cdb2a3ba8]
[bt] (7) /usr/local/lib/libmxnet.so(mxnet::engine::ThreadedEngine::ExecuteOprBlock(mxnet::RunContext, mxnet::engine::OprBlock
)+0x429) [0x7f8cdcb149c9]
[bt] (8) /usr/local/lib/libmxnet.so(void mxnet::engine::ThreadedEnginePerDevice::GPUWorker<(dmlc::ConcurrentQueueType)0>(mxnet::Context, bool, mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<(dmlc::ConcurrentQueueType)0>, std::shared_ptrdmlc::ManualEvent const&)+0xeb) [0x7f8cdcb18c4b]
[bt] (9) /usr/local/lib/libmxnet.so(std::_Function_handler<void (std::shared_ptrdmlc::ManualEvent), mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock
, bool)::{lambda()#3}::operator()() const::{lambda(std::shared_ptrdmlc::ManualEvent)#1}>::_M_invoke(std::_Any_data const&, std::shared_ptrdmlc::ManualEvent&&)+0x4e) [0x7f8cdcb18ece]

Would you please to help me?Thank you.

SNIPER-mxnet core-dumped on Ubuntu 16.04.04

Installation and all compilations went smoothly. However, when run "python demo.py", encountered following error:

*** invalid %N$ use detected ***
Aborted (core dumped)

Further inspection shows a simple test command "import mxnet" gives same error.

Env: ubuntu 16.04.04 (kernel 4.4), CUDA9.0/cudnn 7.0, Nvidia 1080 ti.

Tried another machine with ubuntu 16.04.04 (kernel 4.13) with different CPUs and builds, has exact same error.

Wondering anyone sees same error?

Thanks.

ps: same env runs several mxnet projects without any issue, including Deformable-ConvNet project.

error when training my own dataset

loading annotations into memory... Done (t=0.11s) creating index... index created! num_images 8100 COCO_train2014 gt roidb loaded from ./data/cache/COCO_train2014_gt_roidb.pkl append flipped images to roidb loading annotations into memory... Done (t=0.01s) creating index... index created! num_images 900 COCO_val2014 gt roidb loaded from ./data/cache/COCO_val2014_gt_roidb.pkl append flipped images to roidb filtered 0 roidb entries: 18000 -> 18000 add bounding box regression targets bbox target means: [[0. 0. 0. 0.] [0. 0. 0. 0.]] [0. 0. 0. 0.] bbox target stdevs: [[0.1 0.1 0.2 0.2] [0.1 0.1 0.2 0.2]] [0.1 0.1 0.2 0.2] Creating Iterator with 18000 Images Total number of extracted chips: 30025 Done! Traceback (most recent call last): File "main_train.py", line 78, in <module> threads=config.TRAIN.NUM_THREAD, pad_rois_to=400) File "lib/iterators/MNIteratorE2E.py", line 32, in __init__ super(MNIteratorE2E, self).__init__(roidb, config, batch_size, threads, nGPUs, pad_rois_to, False) File "lib/iterators/MNIteratorBase.py", line 33, in __init__ self.get_batch() File "lib/iterators/MNIteratorE2E.py", line 100, in get_batch self.batch = self._get_batch() File "lib/iterators/MNIteratorE2E.py", line 195, in _get_batch processed_list = processed_list.get() File "/usr/lib/python2.7/multiprocessing/pool.py", line 567, in get raise self._value TypeError: 'NoneType' object has no attribute '__getitem__'

could you help me to fix it?

Avoid image resizing during inference

Hi team,

Another question I have is how to avoid resizing the output image (i.e. output the same image resolution as the input)? One particular example would be for the image below (some random image on Internet), the input resolution is 1023 * 968, however the output resolution is 640 * 480, plus additional white edges. BTW I tried to modify the TEST.SCALES option in the yaml file to a large number but with no luck.
SCALES:

  • !!python/tuple [1400, 2000]
  • !!python/tuple [1400, 2100]
  • !!python/tuple [1400, 2200]

input:
image

output:
image

Got nan loss when training

Hi, I use SNIPER to train my own dataset. When training, I got nan loss as bellow,

Iter[0] Batch[100]   
Train-RPNAcc=nan  
Train-RPNLogLoss=nan  
Train-RPNL1Loss=nan  
Train-RCNNAcc=nan  
Train-RCNNLogLoss=nan  
Train-RCNNL1LossCRCNN=nan

It just occurs every several batches. My batch size is 4, and every 100 batches, it occurs. Other time everything just looks fine like bellow,

Iter[0] Batch[195]   
Train-RPNAcc=0.782257  
Train-RPNLogLoss=0.652749  
Train-RPNL1Loss=0.023370  
Train-RCNNAcc=0.979158  
Train-RCNNLogLoss=2.133237  
Train-RCNNL1LossCRCNN=0.046825

I trying to decrease lr to 0.0005, but not work.

SSH face detector on MXNet.

Hi authors, Great work! And I know that you're migrating caffe SSH to this repo which will be re-write by MXnet. I have done such work these days but can not achieve the same accuracy as it was by Caffe. For example, single scale 79.1% mAP on widerface-hard, vs reported 81.4% from caffe SSH.
Do you have any tips on it?

Thanks.

Try on FPN

Hey,
Sniper is an awesome work. However ,FPN is a standard component of object detection for scales with slightly computation increased. Have you tried to combine Sniper with FPN ?

several question for this impressive work?

  1. there are three branch, i want to know theirs relations, is the model structure is the same, but only train on different data set?
  2. as the master branch i try demo.py(output/sniper_res101_bn/sniper_res101_e2e/train2014_val2014/SNIPER-0007.params) which is coco 81 class, the result is very well especially for small object, so i want to try the openimage image v4's 600 class, i download the pretrained model by scripts, how can i modify the config file and demo.py?

CMake fails

Hello, @mahyarnajibi, I am new to mxnet and when I run the cmake command, it turns out:

-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMake version '3.11.4' using generator 'Unix Makefiles'
-- The CUDA compiler identification is NVIDIA 8.0.26
-- Check for working CUDA compiler: /usr/local/cuda-8.0/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda-8.0/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Performing Test SUPPORT_CXX11
-- Performing Test SUPPORT_CXX11 - Success
-- Performing Test SUPPORT_CXX0X
-- Performing Test SUPPORT_CXX0X - Success
-- Performing Test SUPPORT_MSSE2
-- Performing Test SUPPORT_MSSE2 - Success
CMake Deprecation Warning at 3rdparty/mkldnn/CMakeLists.txt:21 (cmake_policy):
The OLD behavior for policy CMP0048 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.

CMake Deprecation Warning at 3rdparty/mkldnn/CMakeLists.txt:22 (cmake_policy):
The OLD behavior for policy CMP0054 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.

-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- Detecting Intel(R) MKL: trying mklml_intel
-- Detecting Intel(R) MKL: trying mklml
-- Detecting Intel(R) MKL: trying mkl_rt
CMake Warning at 3rdparty/mkldnn/cmake/MKL.cmake:178 (message):
Intel(R) MKL not found. Some performance features may not be available.
Please run scripts/prepare_mkl.sh to download a minimal set of libraries or
get a full version from https://software.intel.com/en-us/intel-mkl
Call Stack (most recent call first):
3rdparty/mkldnn/cmake/OpenMP.cmake:25 (include)
3rdparty/mkldnn/CMakeLists.txt:57 (include)

-- Found OpenMP_C: -fopenmp (found version "3.1")
-- Found OpenMP_CXX: -fopenmp (found version "3.1")
-- Found OpenMP: TRUE (found version "3.1")
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- VTune profiling environment is unset
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Could NOT find MKL (missing: MKL_INCLUDE_DIR MKLML_GNU_LIBRARY MKLDNN_LIBRARY)
-- MKL not found
-- Found CUDA: /usr/local/cuda-8.0 (found version "8.0")
-- Could NOT find MKL (missing: MKL_INCLUDE_DIR MKLML_GNU_LIBRARY MKLDNN_LIBRARY)
-- Found OpenBLAS libraries: /usr/lib/libopenblas.so
-- Found OpenBLAS include: /usr/include
-- Could NOT find Gperftools (missing: GPERFTOOLS_LIBRARIES GPERFTOOLS_INCLUDE_DIR)
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- Could NOT find Jemalloc (missing: JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR)
-- OpenCV_LIBS=opencv_core;opencv_highgui;opencv_imgproc
-- OpenCV found (/usr/share/OpenCV)
-- Found OpenMP_C: -fopenmp
-- Found OpenMP_CXX: -fopenmp
-- Found OpenMP: TRUE
CMake Error at SNIPER/SNIPER-mxnet/build/3rdparty/openmp/runtime/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project):
Generator

Unix Makefiles

does not support toolset specification, but toolset

cuda=,host=x64

was specified.

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error at 3rdparty/openmp/runtime/cmake/LibompGetArchitecture.cmake:57 (try_run):
Failed to configure test project build system.
Call Stack (most recent call first):
3rdparty/openmp/runtime/CMakeLists.txt:40 (libomp_get_architecture)

-- Configuring incomplete, errors occurred!

Would you please be so kind as to help me out? Thanks.

train on new dataset, got low performance

Hi, I try to train SNIPER on my own dataset, but the performance always keep low as bellow,

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.004
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.015
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.002
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.005
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.067
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.125
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.134
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.011
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.176

Loss and accuracy seem just fine as bellow,

Train-RPNAcc=0.965601  
Train-RPNLogLoss=0.114530  
Train-RPNL1Loss=0.009350  
Train-RCNNAcc=0.963693  
Train-RCNNLogLoss=0.225078  
Train-RCNNL1LossC
RCNN=0.085674

Here is the yaml config,

# --------------------------------------------------------------
# SNIPER: Efficient Multi-Scale Training
# Licensed under The Apache-2.0 License [see LICENSE for details]
# by Mahyar Najibi, Bharat Singh
# --------------------------------------------------------------
---
MXNET_VERSION: "mxnet"
output_path: "./output/sniper_res101_bn"
symbol: resnet_mx_101_e2e
gpus: '0'
CLASS_AGNOSTIC: true
default:
  kvstore: device
network:
  pretrained: "./data/pretrained_model/resnet_mx_101_open"
  pretrained_epoch: 0
  PIXEL_MEANS:
  - 103.939
  - 116.779
  - 123.68
  RPN_FEAT_STRIDE: 16
  FIXED_PARAMS:
  - conv0
  - bn0
  - stage1

  ANCHOR_RATIOS:
  - 0.25
  - 0.5
  - 1
  - 2
  - 4
  ANCHOR_SCALES:
  - 2
  - 4
  - 7
  - 10
  - 13
  - 16
  - 24
  NUM_ANCHORS: 35
dataset:
  NUM_CLASSES: 5
  dataset: coco
  dataset_path: "./data/n_classes"
  image_set: train2014
  root_path: "./data"
  test_image_set: val2014
  proposal: rpn
TRAIN:
  ## CHIP GENERATION PARAMS
  # Whether to use C++ or python code for chip generation
  CPP_CHIPS: true
  # How many parts the dataset should be divided to for parallel chip generation
  # This is used to keep the memory limited
  CHIPS_DB_PARTS: 20


  # Multi-processing params
  # These parameters are used for parallel chip generation, NMS, etc.
  # Please consider adjusting them for your system
  NUM_PROCESS: 8
  NUM_THREAD: 8

  # Whether to train with segmentation mask
  WITH_MASK: false

  # Training scales
  # The last scale (or the only scale) should be the desired max resolution in pixels
  # Other scales should be scaling coefficients
  SCALES:
  - 0.5
  - 0.8
  - 2
  - 3.0
  - 1.667
  - 512.0

  # Valid ranges in each scale
  VALID_RANGES:
  - !!python/tuple [-1,-1]
  - !!python/tuple [-1,-1]
  - !!python/tuple [-1,-1]
  - !!python/tuple [-1,-1]
  - !!python/tuple [-1,-1]
  - !!python/tuple [-1,-1]


  lr: 0.0001 #0.002 #0.0005
  lr_step: '5.33'
  warmup: true
  fp16: true
  warmup_lr: 0.0005 #0.00005
  wd: 0.0001
  scale: 100.0
  warmup_step: 1000 #4000 #1000
  begin_epoch: 0
  end_epoch: 100

  # whether flip image
  FLIP: false
  # whether shuffle image
  SHUFFLE: true
  # whether use OHEM
  ENABLE_OHEM: true
  # size of images for each device, 2 for rcnn, 1 for rpn and e2e
  BATCH_IMAGES: 4
  # e2e changes behavior of anchor loader and metric
  END2END: true
  # R-CNN
  # rcnn rois batch size
  BATCH_ROIS: -1
  BATCH_ROIS_OHEM: 256
  # rcnn rois sampling params
  FG_FRACTION: 0.25
  FG_THRESH: 0.5
  BG_THRESH_HI: 0.5
  BG_THRESH_LO: 0.0
  # rcnn bounding box regression params
  BBOX_REGRESSION_THRESH: 0.5
  BBOX_WEIGHTS:
  - 1.0
  - 1.0
  - 1.0
  - 1.0

  # RPN anchor loader
  # rpn anchors batch size
  RPN_BATCH_SIZE: 256
  # rpn anchors sampling params
  RPN_FG_FRACTION: 0.5
  RPN_POSITIVE_OVERLAP: 0.5
  RPN_NEGATIVE_OVERLAP: 0.4
  RPN_CLOBBER_POSITIVES: false
  # rpn bounding box regression params
  RPN_BBOX_WEIGHTS:
  - 1.0
  - 1.0
  - 1.0
  - 1.0
  RPN_POSITIVE_WEIGHT: -1.0
  # used for end2end training
  # RPN proposal
  CXX_PROPOSAL: false
  RPN_NMS_THRESH: 0.7
  RPN_PRE_NMS_TOP_N: 6000
  RPN_POST_NMS_TOP_N: 300
  RPN_MIN_SIZE: 0
  # approximate bounding box regression
  BBOX_NORMALIZATION_PRECOMPUTED: true
  BBOX_MEANS:
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  BBOX_STDS:
  - 0.1
  - 0.1
  - 0.2
  - 0.2
  USE_NEG_CHIPS: false
TEST:
  # Maximum number of detections per image
  # Set to -1 to disable
  MAX_PER_IMAGE: 50

  # Whether to do multi-scale inference
  SCALES:
#  - !!python/tuple [1400, 2000]
  - !!python/tuple [800, 1280]
  - !!python/tuple [480, 512]

  # Number of images per gpu for each scale
  BATCH_IMAGES:
  - 1
  - 1
  - 1

  # Number of concurrent jobs used for inference
  # if greater than 1, the roidb is distributed over
  # concurrent jobs to increase throughput
  CONCURRENT_JOBS: 2

  # Ranges to specify valid proposal length
  # in each of the test scale, square area
  # would be computed based on the lengths
  # to invalidate, -1 means unbounded, use
  # -1 everywhere if you want to have all proposals
  VALID_RANGES:
#  - !!python/tuple [-1,90]
#  - !!python/tuple [32,180]
#  - !!python/tuple [75,-1]
   - !!python/tuple [-1, -1]
   - !!python/tuple [-1, -1]

  # Use rpn to generate proposal
  HAS_RPN: true

  # RPN Parameters
  RPN_NMS_THRESH: 0.7
  RPN_PRE_NMS_TOP_N: 6000
  RPN_POST_NMS_TOP_N: 300
  RPN_MIN_SIZE: 0
  PROPOSAL_NMS_THRESH: 0.7
  PROPOSAL_PRE_NMS_TOP_N: 20000
  PROPOSAL_POST_NMS_TOP_N: 2000
  PROPOSAL_MIN_SIZE: 0

  # NMS Parameters
  # Whether to apply NMS based on threshold or sigma
  NMS: -1 #0.45
  NMS_SIGMA: 0.55

  # Which epoch of the training be used for testing
  TEST_EPOCH: 100

  # VISUALIZATION CONFIG
  VISUALIZATION_PATH: './debug/visualization'
  # Whether to visualize all intermediate scales
  # before aggregation (when doing multi-scale inference)
  # If False, only final detections are saved to 
  # VISUALIZATION_PATH
  VISUALIZE_INTERMEDIATE_SCALES: false

  # PROPOSAL EXTRACTION FLAGS
  # If true only would extract proposals
  EXTRACT_PROPOSALS: false

  # The folder path to be used for saving proposals
  PROPOSAL_SAVE_PATH: 'output/proposals'

  # Number of proposals extracted per scale
  # SCALES and BATCH_IMAGES above would be used to
  # Specify scales and number of images per batch for
  # each scale, no valid ranges would be applied for
  # aggregating proposals
  N_PROPOSAL_PER_SCALE: 300

I have struggled for several days but couldn't figure it out.
Hope you can give some advice.
Thanks :)

Failed to run the R-FCN 3K demo - nnvm check failed

Hi,

First of all, thanks for providing this nicely organized repo.
I have successfully run SNIPER demo without any problem.
However, for R-FCN 3K, I am not able to run the demo. There is strange error, which originates from asnumpy() function.
The error message I got is
SNIPER/CRCNN-mxnet/3rdparty/nnvm/include/nnvm/tuple.h:438: Check failed: dim == static_cast(ndim()) (2 vs. 1) dimension do not match target dimension 2 vs 1

I am using CUDA 9.1 with cuDNN 7.02 on a P3.x16 machine.

I have tried diffrent configures on the cmake, e.g., with/withou mkl, but I still cannot figure out what is the problem.

I can easily convert other NDArray to numpy array without any problem. I just cannot convert the output of the R-FCN network.

Please advise.

BUG: bash scripts/compile.sh

When I try bash scripts/compile.sh
Here are bugs:

x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-Wdate-time’
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

My solution is as follows:
sudo rm -r /usr/bin/gcc
sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
sudo rm /usr/bin/x86_64-linux-gnu-gcc
sudo ln -s /usr/bin/gcc-5 /usr/bin/x86_64-linux-gnu-gcc

links

demo code for OpenImage inference

Great work. I think it would be really great if there is an inference example script for running openimagev4 pretrained model just similar the current demo.py (COCO).

SNIP code

Hi , I tried to use SNIPER on a new dataset but the perfomance is not satisfying. I think the problem is that my own neg-chips are not as good as yours in coco dataset. Could you please release the SNIP code so that I can train my dataset on SNIP and compare their performances?

Thanks a lot

Question of aplicability of method

Hello,
I have read the SNIPER paper and something is not clear to me.
Is this training/inference method compatible only with 2 stage detectors like Faster RCNN?
Or can it also be applied to SSD?

Thank you

cuda error when run the demo

hi, I've tried to run the 'demo.py' file, then met the error like:
mxnet.base.MXNetError: [22:56:26] /home/vis/xuxiaqing/code/code_my/video_detection/SNIPER/SNIPER-mxnet/src/operator/nn/batch_norm.cu:527: Check failed: err == cudaSuccess (7 vs. 0) Name: BatchNormalizationUpdateOutput ErrStr:too many resources requested for launch

My cuda version is 8.0, the cudnn version is 5.0. Are there any tips for solving this problem? many thanks~

main_train.py CUDA error: too many resources requested for launch

when i train use main_train.py, appear the following question.

Optimizer params: {'wd': 0.01, 'lr_scheduler': <train_utils.lr_scheduler.WarmupMultiBatchScheduler object at 0x7fe7702edd90>, 'multi_precision': True, 'learning_rate': 0.00015, 'rescale_grad': 1.0, 'clip_gradient': None, 'momentum': 0.9}
aaa
[00:33:49] /home/czn/scc/SNIPER/SNIPER-mxnet/src/operator/nn/./cudnn/./cudnn_algoreg-inl.h:107: Running performance tests to find the best convolution algorithm, this can take a while... (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable)
CUDA error: too many resources requested for launch

pretrained openimages model

Really awesome work!
Do you plan to release an inference script for the openimages2 branch, as well as a pretrained model?

The speed of mobilenetv2 is slow when i run the demo.py on the test phrase

i run the demo.py with mobilenetv2 model on the P40 ,about 150ms,the speed is slow,something wrong?
i never change the config.

Tester: 1/1, Detection: 0.1813s, Post Processing: 0.001738s
Tester: 1/1, Detection: 0.1461s, Post Processing: 0.001268s
Tester: 1/1, Detection: 0.1313s, Post Processing: 0.001222s

openimage branch clone SNIPER-mxnet permission denied

Hi, I am trying to clone the openimage branch by using command:

git clone -b openimages2 --recursive https://github.com/mahyarnajibi/SNIPER.git

and I got a fatal error stating that I cannot read from SNIPER-mxnet remote module. The complete error message is as follow:

Cloning into 'SNIPER'...
remote: Counting objects: 1663, done.
remote: Compressing objects: 100% (89/89), done.
remote: Total 1663 (delta 45), reused 96 (delta 34), pack-reused 1540
Receiving objects: 100% (1663/1663), 22.00 MiB | 9.45 MiB/s, done.
Resolving deltas: 100% (1009/1009), done.
Checking connectivity... done.
Submodule 'SNIPER-mxnet' ([email protected]:mahyarnajibi/SNIPER-mxnet.git) registered for path 'SNIPER-mxnet'
Cloning into 'SNIPER-mxnet'...
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is SHA256:nThbg********************************6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:mahyarnajibi/SNIPER-mxnet.git' into submodule path 'SNIPER-mxnet' failed

resnet50?

Hi,

Which specific model did you use for Resnet 50? Can you provide the link to download the pre-trained resnet50 on imagenet? Looks like it's not available in the mxnet model zoo...

Thanks!

Question: Can the model trained using this repo be run on regular MXNet?

Hi, I have a quick question regarding model inference. Let's say I've trained a model using SNIPER, for a regular object detection task, can the model be served:

  • using the official MXNet build?
  • using CPU?

The reason is that for some reason, we need to inference the model on CPU. I guess it might be possible since the NN is still standard resnet + faster RCNN, but I am not sure about this (since I do see a few updates in the SNIPER-mxnet module which might be relevant to accomplish the goal above).

Thanks!

Openimages 600 classes demo

Hello, @mahyarnajibi ! It is possible to test your pretrained model to detect 600 classes? I check branch openimages2 and in config see pretrained: "./data/pretrained_model/CRCNN" row, but bash scripts/download_pretrained_model.sh doesn't download anything, but only resnet_mx_101_open-0000(and imagenet ofc). This is what we need, this model is pretraied for 600 classes? and we need only move(or replace config's row with path) model to CRCNN folder and run python demo.py with custom config?

Multi_proposal_target_layer

If I change rpn_post_nms_top_n, the metric will get wrong at

pred_label = pred.asnumpy().reshape(-1, last_dim).argmax(axis=1).astype('int32')

How to get negative chips?

Hi,

I am currently trying to improve my performance for a certain dataset, and I am not using negative chips to train my algorithms. From the visualization it looks fine, however there are some false positives that I do want to avoid. I am pretty sure that is because of the fact that I don't do negative chip training.

Can you specify more on how to get the negative chips? From the paper it says:

To this end, for negative chip mining, we first train RPN for a couple of epochs. No negative chips are used for training this network. The task of this network is to roughly guide us in selecting regions which are likely to contain false positives, so it is not necessary for it to be very accurate. This RPN is used to generate proposals over the entire training set. We assume that if no proposals are generated in a major portion of the image by RPN, then it is unlikely to contain an object instance.

And in the code, I found that there's a setting called TEST.EXTRACT_PROPOSALS - but reading thru the code, I am not sure if it is doing what's described in the paper.

Any pointers will be appreciated! Thanks!

How to train this on a new dataset ?

I'm using a custom dataset. But it's asking for RPN weights, is there any way to bypass that. If I load the weights, it failing with the following error:

Loading data/proposals/voc_2007_trainval_rpn.pkl....
Done!
Applying NMS...
Traceback (most recent call last):
  File "main_train.py", line 59, in <module>
    for image_set in image_sets]
  File "lib/data_utils/load_data.py", line 32, in load_proposal_roidb
    roidb = eval('imdb.' + proposal + '_roidb')(roidb, append_gt,proposal_path=proposal_path)
  File "lib/dataset/imdb.py", line 139, in rpn_roidb
    rpn_roidb = self.load_rpn_roidb(gt_roidb,proposal_path)
  File "lib/dataset/imdb.py", line 126, in load_rpn_roidb
    box_list, mapping_list = self.load_rpn_data(proposal_path)
  File "lib/dataset/imdb.py", line 109, in load_rpn_data
    keeps = p.map(nmsp, ttboxes)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 251, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 567, in get
    raise self._value
IndexError: too many indices for array

Can not train on new dataset

Hello,

First of all thank you for putting the code here on github so we can all use and experiment with it.
I am trying to train on my own dataset,but I am having a little bit of trouble.
More specifically, I have this error:
File "lib/iterators/MNIteratorE2E.py", line 194, in _get_batch
processed_list = processed_list.get()
File "/home/radud/anaconda3/envs/mxnetpy2/lib/python2.7/multiprocessing/pool.py", line 572, in get
raise self._value
TypeError: 'NoneType' object has no attribute 'getitem'

Any help would be appreciated.
Thank you.

How to train new proposals?

Thanks for open sourcing the code, it looks great!

One question I have is how to train new proposals? Since I want to use SNIPER in a very different dataset, I assume the best way for me is to re-calculate the proposals? In that case, how do I re-train the proposal network?

Thanks!

I meet the fillowing question

/usr/local/lib/python2.7/dist-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "demo.py", line 123, in
main()
File "demo.py", line 87, in main
convert=True, process=True)
File "lib/train_utils/utils.py", line 90, in load_param
arg_params, aux_params = load_checkpoint(prefix, epoch)
File "lib/train_utils/utils.py", line 56, in load_checkpoint
save_dict = mx.nd.load('%s-%04d.params' % (prefix, epoch))
File "/home/czn/scc/SNIPER/SNIPER-mxnet/python/mxnet/ndarray/utils.py", line 175, in load
ctypes.byref(names)))
File "/home/czn/scc/SNIPER/SNIPER-mxnet/python/mxnet/base.py", line 149, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [04:49:05] /home/czn/scc/SNIPER/SNIPER-mxnet/src/ndarray/ndarray.cc:1770: Check failed: fi->Read(data) Invalid NDArray file format

Stack trace returned 10 entries:
[bt] (0) /home/czn/scc/SNIPER/SNIPER-mxnet/python/mxnet/../../build/libmxnet.so(dmlc::StackTraceabi:cxx11+0x56) [0x7ff817364586]
[bt] (1) /home/czn/scc/SNIPER/SNIPER-mxnet/python/mxnet/../../build/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x28) [0x7ff817364d38]
[bt] (2) /home/czn/scc/SNIPER/SNIPER-mxnet/python/mxnet/../../build/libmxnet.so(mxnet::NDArray::Load(dmlc::Stream*, std::vector<mxnet::NDArray, std::allocatormxnet::NDArray >, std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >)+0x204) [0x7ff817586e44]
[bt] (3) /home/czn/scc/SNIPER/SNIPER-mxnet/python/mxnet/../../build/libmxnet.so(MXNDArrayLoad+0xc1) [0x7ff81754c471]
[bt] (4) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7ff82fa2ee40]
[bt] (5) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x2eb) [0x7ff82fa2e8ab]
[bt] (6) /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(_ctypes_callproc+0x48f) [0x7ff82fc3e3df]
[bt] (7) /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(+0x11d82) [0x7ff82fc42d82]
[bt] (8) python(PyEval_EvalFrameEx+0x578f) [0x4c15bf]
[bt] (9) python(PyEval_EvalCodeEx+0x306) [0x4b9ab6]

KeyError: 'proposal_scores' when FLIP is set to true

when FLIP is set to true, running the repository against coco will produce some error like below:

wrote gt roidb to /data/cache/COCO_train2014_gt_roidb.pkl
append flipped images to roidb
Traceback (most recent call last):
  File "main_train.py", line 59, in <module>
    for image_set in image_sets]
  File "lib/data_utils/load_data.py", line 36, in load_proposal_roidb
    roidb = imdb.append_flipped_images(roidb)
  File "lib/dataset/imdb.py", line 249, in append_flipped_images
    'proposal_scores': roidb[i]['proposal_scores']}
KeyError: 'proposal_scores'

And changing FLIP to false will eliminate the error. I suspect there's something wrong with the flipping logic (didn't dig deep though).

Where is the CRCNN-1epoch?

Hi,I am training my model in openimages dataset. I see in your openimage config file that you used a pretrained model called CRCNN-1epoch.But I download your pretrain model with bash scripts/download_pretrained_model.sh ,but there is no file named CRCNN-0001.Can you tell me where is this file to download.

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.