imatge-upc / rvos

RVOS: End-to-End Recurrent Network for Video Object Segmentation (CVPR 2019)
https://imatge-upc.github.io/rvos/
Other
277 stars 54 forks source link

Creating the mask for one-shot model #24

Closed dl002 closed 4 years ago

dl002 commented 4 years ago

Thank you for sharing your code. I am trying to get this to work for my data. I can run the demo.py with the pre-trained models for the one-shot scenario using the command python demo.py -model_name one-shot-model-davis --overlay_masks. But when I try to run it for my data with the command python demo.py -model_name one-shot-model-davis -frames_path path-to-your-frames -mask_path path-to-initial-mask --overlay_masks, it gives me the following error.

[WARNING][05-11-2019 18:46:24] Temporal stability not available
Results will be saved to: ../models/../models/one-shot-model-youtubevos/results/JPEGImages
Loading model: ../models/one-shot-model-youtubevos
Namespace(all_classes=False, augment=True, base_model='resnet101', batch_size=4, best_val_loss=1000, cat_id=-1, class_loss_after=20, class_th=0.5, class_weight=0.1, crop=False, curriculum_learning=False, dataset='youtube', display=False, display_route=False, dropout=0.0, dropout_cls=0.0, dropout_stop=0.0, epoch_resume=0, eval_split='test', finetune_after=0, gpu_id=0, gt_maxseqlen=10, hidden_size=128, imsize=480, iou_weight=1.0, kernel_size=3, length_clip=5, log_file='train.log', log_term=False, lr=0.001, lr_cnn=1e-06, mask_th=0.5, max_dets=100, max_epoch=100, maxseqlen=10, min_delta=0.0, min_size=0.001, min_steps=1, model_name='spatiotemporal_youtube_bs_04_lc_05_256p', momentum=0.9, ngpus=1, no_display_text=False, no_run_coco_eval=False, num_classes=21, num_workers=1, only_temporal=False, optim='adam', optim_cnn='adam', pascal_dir='/databases/voc2012/VOCAug/', patience=15, patience_stop=60, port=8097, print_every=10, resize=True, resume=False, rotation=10, seed=123, server='http://localhost', shear=0.1, single_object=False, skip_mode='concat', smooth_curves=False, steps_cl=1, stop_balance_weight=0.5, stop_loss_after=-1, stop_th=0.5, stop_weight=0.5, transfer=True, transfer_from='spatiotemporal_youtube_bs_04_lc_05_256p_prev_mask', translation=0.1, update_encoder=False, use_cats=True, use_class_loss=False, use_gpu=True, use_gt_cats=False, use_gt_masks=False, use_gt_stop=False, use_stop_loss=False, visdom=False, weight_decay=1e-06, weight_decay_cnn=1e-06, year='2017', youtube_dir='/databases/YouTubeVOS/', zoom=0.7)
video mode activated
Traceback (most recent call last):
  File "demo.py", line 288, in <module>
    results.save_result_overlay(x, outs, frame_name)
  File "demo.py", line 225, in save_result_overlay
    mask_pred = (torch.squeeze(net_outs[0, t, :])).cpu().numpy()
IndexError: index 10 is out of bounds for dimension 1 with size 10

To isolate the problem, I replaced my mask with one of the masks in the DAVIS dataset. Although it gives wrong results(as expected) the code runs without issue. So I think the issue is in my mask. Can you please tell me what is the best way to create the masks? I used Matlab GraphCut tool to get the .png mask. Since this .png image did not have a palette(it gave None for image.getpalette()), I converted it in another Python script using im.convert("P", palette=Image.WEB, colors=256) before giving as mask for your code. Can you please tell the correct way to create the mask?

Thank you.

wenchen4321 commented 3 years ago

Hello, I have meet the problem as same as yours. Could you please tell me how you solve this problem?