ijkguo / mx-rcnn

Parallel Faster R-CNN implementation with MXNet.
Other
671 stars 290 forks source link

How to do Inference on multiple images #95

Closed Ram-Godavarthi closed 6 years ago

Ram-Godavarthi commented 6 years ago

@ijkguo @li-haoran How to get inference for multiple images with the help of demo.py? I have 2 classes. i have done training.. I have got the test accuracy of 85%. Now i want to visualize the output on some 100's of images. How to proceed with it? because with demo.py we could visualize only 1 image at a time.. How to get it for N number of images ...

Any help is really appreciated.

ijkguo commented 6 years ago

Follow the demo script and use a for loop to do inference on a list of images.

Ram-Godavarthi commented 6 years ago

@ijkguo I have done training on 200 images as example. But i want to test it on some images. But when i run demo.py. i am getting only 1 class per image. I have total of 3 classes ( person, bicycle, background) i have feeded the network with 101 images of each class.

What could be the problem?

ijkguo commented 6 years ago

Have you resolve the original issue, do demo on multiple images?

Ram-Godavarthi commented 6 years ago

@ijkguo Yes i have done...

ijkguo commented 6 years ago

Then your description of the new problem is that you have 200 images, 101 images contain person, 101 contain bicycle and 101 contain background (so 3 of them has all 3 classes?). After training (not clear how to feed 101 of image to network?), you run demo scripts on (some data, not known but could have person and bicycle?). The output (not known, maybe visualization or printout?) is only 1 class per image.

Ram-Godavarthi commented 6 years ago

No,

  1. I have 2 classes ( person, Bicycle)

  2. I have taken 100 images with 1 person in each image. And 100 images with 1 bicycle in each image. (All single object images)

  3. I have feeded these to the network (total 200 images)

  4. After training, I executed test.py. And i got 80% accuracy.

  5. Now i want to check this Model on Some fresh data . This fresh data contains both Person and Bicycle in Each image (dual object images) This model has to predict the classes correctly..

But i am getting only 1 object detected per image..

But i trained the netowork using incubator mxnet-rcnn and got the model after 8 epochs. When i give that params file to demo.py in this repo, i could able to detect the classes (not so great, but it is okay. Some images are detected correctly)

Now I want to increase the dataset and do it again..

ijkguo commented 6 years ago

Make sure all config (printed or in code) between mxnet/rcnn/example and mx-rcnn are the same. Fun facts: VOC07++12 has 16k images; COCO train2017 has 118k images; KITTI trainval has 7k images. Look at some sample images from COCO in the README: they have many objects in one image.

Ram-Godavarthi commented 6 years ago

@ijkguo My input images are grayscale images. But vgg16 takes only rgb input. Can i feed the network with grayscale images (1, 512, 512) instead of (3, 512, 512)?

In this repo, the input is fed as rgb irrespective of the input channels.. Is there any way make it SINGLE CHANNEL INPUT?

ijkguo commented 6 years ago

Our models are initialized from models trained on ImageNet image classification dataset, which are color images. You might want a pretrained model on grey scale images.

Ram-Godavarthi commented 6 years ago

Is there a pretrained model on grey scale images compatible with mxnet? Is mobilenet accepts grey scale images?? Can i use those convolution layers instead of vgg16 and resnet layers..??

ijkguo commented 6 years ago

I am not aware of grey scale models.

ijkguo commented 6 years ago

Original issue resolved by user. Custom dataset training issue moved to https://github.com/ijkguo/mx-rcnn/issues/98