jd730 / OICR-pytorch

Pytorch Implementation of Multiple Instance Detection Network with Online Instance Classifier Refinement
MIT License
75 stars 10 forks source link

I can't find evalutaion.py #6

Closed Mickeybaby closed 5 years ago

Mickeybaby commented 5 years ago

I can't find evalutaion.py. I don't know how to use your code to get mAP. Thank you

jd730 commented 5 years ago

@Mickeybaby Hi, you can use test_oicr.py. See this

Also, voc_eval.py conducts an evaluation.

Mickeybaby commented 5 years ago

When I run test.py Preparing training data... done 9904 roidb entries output/test/log.txt file already exists output/test/log_7.txt output/test/progress.csv file already exists Logging to output/test output/test Traceback (most recent call last): File "test_oicr.py", line 372, in raise Exception("Model does not exist") Exception: Model does not exist

jd730 commented 5 years ago

Could you tell me the script what you ran exactly? Did you set a model as 'oicr' ?

The error comes from setting the wrong model (in this code, it should be 'oicr'

Mickeybaby commented 5 years ago

@a208-System-Product-Name:~/OICR-pytorch$ CUDA_VISIBLE_DEVICES=0 python3 test_oicr.py --dataset pascal_voc --net vgg16 --checkpoint 70000 --load_dir='output' --cuda --model='oicr'--vis Called with args: Namespace(cfg_file='cfgs/vgg16.yml', checkpoint=70000, class_agnostic=False, cuda=True, dataset='pascal_voc', large_scale=False, load_dir='output', mGPUs=False, model='oicr--vis', net='vgg16', output_dir='test', parallel_type=0, restore=False, set_cfgs=None, threshold=0.5, vis=False) /home/mickey/OICR-pytorch/lib/model/utils/config.py:392: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. yaml_cfg = edict(yaml.load(f)) Using config: {'ANCHOR_RATIOS': [0.5, 1, 2], 'ANCHOR_SCALES': [8, 16, 32], 'CROP_RESIZE_WITH_MAX_POOL': False, 'CUDA': False, 'DATA_DIR': '/home/mickey/OICR-pytorch/data', 'DEDUP_BOXES': 0.125, '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': 2, 'ROOT_DIR': '/home/mickey/OICR-pytorch', 'TEST': {'BBOX_REG': True, 'HAS_RPN': True, 'MAX_SIZE': 2000, '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': [480, 576, 688, 864, 1200], 'SVM': False, 'USE_FLIPPED': True}, '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': 2, 'LEARNING_RATE': 0.01, 'MAX_IMAGE_SIZE': 2000, 'MAX_ROIS_SIZE': 6000, 'MAX_SIZE': 2000, 'MOMENTUM': 0.9, 'PROPOSAL_LIMIT': 2000, 'PROPOSAL_METHOD': 'selective_search', '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': [480, 576, 688, 864, 1200], 'SNAPSHOT_ITERS': 5000, 'SNAPSHOT_KEPT': 3, 'SNAPSHOT_PREFIX': 'res101_faster_rcnn', 'STEPSIZE': [40000], 'SUMMARY_INTERVAL': 180, 'TRIM_HEIGHT': 600, 'TRIM_WIDTH': 600, 'TRUNCATED': False, 'USE_ALL_GT': True, 'USE_FLIPPED': True, 'USE_GT': False, 'USE_SEG': True, 'WEIGHT_DECAY': 0.0005}, 'USE_GPU_NMS': True} Loaded dataset voc_2007_test for training Set proposal method: selective_search Appending horizontally-flipped training examples... voc_2007_test ss roidb loaded from /home/mickey/OICR-pytorch/data/cache/voc_2007_test_selective_search_roidb.pkl done Preparing training data... done 9904 roidb entries output/test/log.txt file already exists output/test/log_8.txt output/test/progress.csv file already exists Logging to output/test output/test Traceback (most recent call last): File "test_oicr.py", line 372, in raise Exception("Model does not exist") Exception: Model does not exist

jd730 commented 5 years ago

--model='oicr'--vis should be changed to --model='oicr' --vis (add space between ' and --)

Mickeybaby commented 5 years ago

Thank you so much!

Mickeybaby commented 5 years ago

@a208-System-Product-Name:~/OICR-pytorch$ CUDA_VISIBLE_DEVICES=0 python3 test_oicr.py --dataset pascal_voc --net vgg16 --checkpoint 70000 --load_dir='output' --cuda --model='oicr' --vis Called with args: Namespace(cfg_file='cfgs/vgg16.yml', checkpoint=70000, class_agnostic=False, cuda=True, dataset='pascal_voc', large_scale=False, load_dir='output', mGPUs=False, model='oicr', net='vgg16', output_dir='test', parallel_type=0, restore=False, set_cfgs=None, threshold=0.5, vis=True) /home/mickey/OICR-pytorch/lib/model/utils/config.py:392: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. yaml_cfg = edict(yaml.load(f)) Using config: {'ANCHOR_RATIOS': [0.5, 1, 2], 'ANCHOR_SCALES': [8, 16, 32], 'CROP_RESIZE_WITH_MAX_POOL': False, 'CUDA': False, 'DATA_DIR': '/home/mickey/OICR-pytorch/data', 'DEDUP_BOXES': 0.125, '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': 2, 'ROOT_DIR': '/home/mickey/OICR-pytorch', 'TEST': {'BBOX_REG': True, 'HAS_RPN': True, 'MAX_SIZE': 2000, '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': [480, 576, 688, 864, 1200], 'SVM': False, 'USE_FLIPPED': True}, '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': 2, 'LEARNING_RATE': 0.01, 'MAX_IMAGE_SIZE': 2000, 'MAX_ROIS_SIZE': 6000, 'MAX_SIZE': 2000, 'MOMENTUM': 0.9, 'PROPOSAL_LIMIT': 2000, 'PROPOSAL_METHOD': 'selective_search', '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': [480, 576, 688, 864, 1200], 'SNAPSHOT_ITERS': 5000, 'SNAPSHOT_KEPT': 3, 'SNAPSHOT_PREFIX': 'res101_faster_rcnn', 'STEPSIZE': [40000], 'SUMMARY_INTERVAL': 180, 'TRIM_HEIGHT': 600, 'TRIM_WIDTH': 600, 'TRUNCATED': False, 'USE_ALL_GT': True, 'USE_FLIPPED': True, 'USE_GT': False, 'USE_SEG': True, 'WEIGHT_DECAY': 0.0005}, 'USE_GPU_NMS': True} Loaded dataset voc_2007_test for training Set proposal method: selective_search Appending horizontally-flipped training examples... voc_2007_test ss roidb loaded from /home/mickey/OICR-pytorch/data/cache/voc_2007_test_selective_search_roidb.pkl done Preparing training data... done 9904 roidb entries output/test/log.txt file already exists output/test/log_10.txt output/test/progress.csv file already exists Logging to output/test output/test load checkpoint output/vgg16/pascal_voc/070000.pth Traceback (most recent call last): File "test_oicr.py", line 377, in checkpoint = torch.load(load_name) File "/home/mickey/anaconda3/envs/OICR/lib/python3.6/site-packages/torch/serialization.py", line 301, in load f = open(f, 'rb') FileNotFoundError: [Errno 2] No such file or directory: 'output/vgg16/pascal_voc/070000.pth' Before that, I had run train_val.py successfully.

jd730 commented 5 years ago

Hmm, did you set save_dir as 'output'? (cf. the default is models)

Mickeybaby commented 5 years ago

I set it up according to your 'read me' CUDA_VISIBLE_DEVICES=0 python3 trainval_net.py --dataset pascal_voc --net vgg16 \ --bs 2 --nw 4 --save_dir='output' --model='oicr' \ --lr 0.001 --cuda --disp_interval 50 --mGPUs --vis \ --checkpoint_interval=500

jd730 commented 5 years ago

So, does the file output/vgg16/pascal_voc/070000.pth exist?

Mickeybaby commented 5 years ago

This document does not exist. Is there something wrong with the training process? But I set it up according to your 'read me'.

jd730 commented 5 years ago

The script what you used seems correct. Setting the script, the model saves a checkpoint every 500 iterations on output/pascal_voc and log the screen output to output/log/log.txt and losses and iterations to output/log/progress.csv. Also, it saves the images every 500 iterations on output/images.

Which files and folders do you have in output?

Mickeybaby commented 5 years ago

This ‘output’ folder contains :'vgg16' folder, 'test' folder, 'log' folder. 'vgg16' folder contains 'pascal_voc' folder. But the 'pascal_voc' is empty. 'test' folder contains 'map' folder, 'images' folder, 'corloc' folder, some progress.csv and some log.txt. 'log' folder contains some progress.csv and some log.txt.

jd730 commented 5 years ago

Thank you for giving the information. This is weird you do not have images folder since you set --vis flag. Could you see the log.txt or log1.txt or ...
Could you find save model : and image save?

What is the last iteration according to log or progress files?

Mickeybaby commented 5 years ago

I can see the log.txt or log1.txt or... I can't find save model: and image save According to the 'log' folder,the last iteration is 7 But in the 'test' folder,the last iteration is 10. After the training, there is also a 'results' file .In results/log the iteration is 11. In results/test_single/vgg16/pascal_voc, I can find 007000.pth and .....pth

Mickeybaby commented 5 years ago

I found the images folder ,results/test_single/images

jd730 commented 5 years ago

Then, I guess you used run.sh which set results/test_single as save_dir for training. Now, what you need to do is only change load_dir as that directory.

jd730 commented 5 years ago

Sorry, what I said about iteration is iterations in log*.txt. When you run the code, it automatically generate log.txt log_1.txt, ... to preventing from overwriting the log.

jd730 commented 5 years ago

@Mickeybaby Did you solve the problem? Can I close this issue?

Mickeybaby commented 5 years ago

Thank you for your help in solving this problem.