I am pretty disappointed in myself. Appologies for my stupid question in advance. I am pretty new to all these detection stuff and pytorch thing.
I went through the way that you explained to run the demo.
I guess i have everything set as you said.
I have a data folder, inside of it i have two folders (pretrained_model and VOCdevkit2007). the VOCdevkit2007 is created via softlink.
In the pretrained_model folder I have resnet101_caffe.pth and vgg16_caffe.pth.
I am trying to run the demo to run it on the images that you provided on the images folder.
So I am going to run this command:
python demo.py --net vgg16 \
--checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \
--cuda --load_dir path/to/model/directoy
and i run it like this:
python demo.py --net vgg16 \
--checksession 1 --checkepoch 6 --checkpoint 416 \
--cuda --load_dir /data/pretrained_model/vgg16_caffe.pth
am i doing anything wrong so far?
This is what happened and it is not working:
Called with args:
Namespace(batch_size=1, cfg_file='cfgs/vgg16.yml', checkepoch=6, checkpoint=416, checksession=1, class_agnostic=False, cuda=True, dataset='pascal_voc', image_dir='images', load_dir='/data/pretrained_model/vgg16_caffe.pth', mGPUs=False, net='vgg16', parallel_type=0, set_cfgs=None, vis=False, webcam_num=-1)
Using config:
{'ANCHOR_RATIOS': [0.5, 1, 2],
'ANCHOR_SCALES': [8, 16, 32],
'CROP_RESIZE_WITH_MAX_POOL': False,
'CUDA': False,
'DATA_DIR': '/home/alireza/Desktop/Code/VID/FRCNN2/faster-rcnn.pytorch/data',
'DEDUP_BOXES': 0.0625,
'EPS': 1e-14,
'EXP_DIR': 'vgg16',
'FEAT_STRIDE': [16],
'GPU_ID': 0,
'MATLAB': 'matlab',
'MAX_NUM_GT_BOXES': 20,
'MOBILENET': {'DEPTH_MULTIPLIER': 1.0,
'FIXED_LAYERS': 5,
'REGU_DEPTH': False,
'WEIGHT_DECAY': 4e-05},
'PIXEL_MEANS': array([[[102.9801, 115.9465, 122.7717]]]),
'POOLING_MODE': 'align',
'POOLING_SIZE': 7,
'RESNET': {'FIXED_BLOCKS': 1, 'MAX_POOL': False},
'RNG_SEED': 3,
'ROOT_DIR': '/home/alireza/Desktop/Code/VID/FRCNN2/faster-rcnn.pytorch',
'TEST': {'BBOX_REG': True,
'HAS_RPN': True,
'MAX_SIZE': 1000,
'MODE': 'nms',
'NMS': 0.3,
'PROPOSAL_METHOD': 'gt',
'RPN_MIN_SIZE': 16,
'RPN_NMS_THRESH': 0.7,
'RPN_POST_NMS_TOP_N': 300,
'RPN_PRE_NMS_TOP_N': 6000,
'RPN_TOP_N': 5000,
'SCALES': [600],
'SVM': False},
'TRAIN': {'ASPECT_GROUPING': False,
'BATCH_SIZE': 256,
'BBOX_INSIDE_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
'BBOX_NORMALIZE_MEANS': [0.0, 0.0, 0.0, 0.0],
'BBOX_NORMALIZE_STDS': [0.1, 0.1, 0.2, 0.2],
'BBOX_NORMALIZE_TARGETS': True,
'BBOX_NORMALIZE_TARGETS_PRECOMPUTED': True,
'BBOX_REG': True,
'BBOX_THRESH': 0.5,
'BG_THRESH_HI': 0.5,
'BG_THRESH_LO': 0.0,
'BIAS_DECAY': False,
'BN_TRAIN': False,
'DISPLAY': 10,
'DOUBLE_BIAS': True,
'FG_FRACTION': 0.25,
'FG_THRESH': 0.5,
'GAMMA': 0.1,
'HAS_RPN': True,
'IMS_PER_BATCH': 1,
'LEARNING_RATE': 0.01,
'MAX_SIZE': 1000,
'MOMENTUM': 0.9,
'PROPOSAL_METHOD': 'gt',
'RPN_BATCHSIZE': 256,
'RPN_BBOX_INSIDE_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
'RPN_CLOBBER_POSITIVES': False,
'RPN_FG_FRACTION': 0.5,
'RPN_MIN_SIZE': 8,
'RPN_NEGATIVE_OVERLAP': 0.3,
'RPN_NMS_THRESH': 0.7,
'RPN_POSITIVE_OVERLAP': 0.7,
'RPN_POSITIVE_WEIGHT': -1.0,
'RPN_POST_NMS_TOP_N': 2000,
'RPN_PRE_NMS_TOP_N': 12000,
'SCALES': [600],
'SNAPSHOT_ITERS': 5000,
'SNAPSHOT_KEPT': 3,
'SNAPSHOT_PREFIX': 'res101_faster_rcnn',
'STEPSIZE': [30000],
'SUMMARY_INTERVAL': 180,
'TRIM_HEIGHT': 600,
'TRIM_WIDTH': 600,
'TRUNCATED': False,
'USE_ALL_GT': True,
'USE_FLIPPED': True,
'USE_GT': False,
'WEIGHT_DECAY': 0.0005},
'USE_GPU_NMS': True}
Traceback (most recent call last):
File "demo.py", line 163, in <module>
raise Exception('There is no input directory for loading network from ' + input_dir)
Exception: There is no input directory for loading network from /data/pretrained_model/vgg16_caffe.pth/vgg16/pascal_voc
Can anyone please help me .... Thanks
Hi, you have to distinguish between a pre-trained model like vgg16 or res101 (which is the base for faster-rcnn) and the model you train, which will be used in demo.py. So first run a training, which will give you a model, and you can then use this model to run the demo.
@cbasavaraj I dont have a good GPU at the moment to train my network.
I thought if i download the pre trained model from here I should be able to run the demo. is not that possible?
Is there anyway to try the demo without training?
You can try Google Cloud, they give you USD 250 worth free compute time. Train your model there.
This repo doesn't have a trained faster-rcnn. Not sure about other places.
@cbasavaraj Thank you for your help. I will try google cloud.
but in the repository what they mean when they said:
Pretrained Model
We used two pretrained models in our experiments, VGG and ResNet101. You can download these two models from:
VGG16: Dropbox, VT Server
ResNet101: Dropbox, VT Server
Download them and put them into the data/pretrained_model/.
what are these pretrained model useful for?
These models are pre-trained on ImageNet images for classification only. So you use them as the backbone for faster-rcnn which is an object detection architecture that can use many different underlying CNNs. Faster-RCNN itself has to be trained by you now for object detection.
@isalirezag I am also a freshman to PyTorch and Faster R-CNN. And I also encounter the same problem.I'm wondering if you have solved this problem!
Most helpful comment
These models are pre-trained on ImageNet images for classification only. So you use them as the backbone for faster-rcnn which is an object detection architecture that can use many different underlying CNNs. Faster-RCNN itself has to be trained by you now for object detection.