You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: proposal_visual_debug.m
    path of file: ./repos/faster_rcnn/functions/rpn
    
    the code of the file until where you have to start completion: function proposal_visual_debug(conf, image_roidb, input_blobs, bbox_means, bbox_stds, classes, scale_inds)
% proposal_visual_debug(conf, image_roidb, input_blobs, bbox_means, bbox_stds, classes, scale_inds)
% --------------------------------------------------------
% Faster R-CNN
% Copyright (c) 2015, Shaoqing Ren
% Licensed under The MIT License [see LICENSE for details]
% --------------------------------------------------------   

    im_blob = input_blobs{1};
    labels_blob = input_blobs{2};
    label_weights_blob = input_blobs{3};

    
function proposal_visual_debug(conf, image_roidb, input_blobs, bbox_means, bbox_stds, classes, scale_inds)
% proposal_visual_debug(conf, image_roidb, input_blobs, bbox_means, bbox_stds, classes, scale_inds)
% --------------------------------------------------------
% Faster R-CNN
% Copyright (c) 2015, Shaoqing Ren
% Licensed under The MIT License [see LICENSE for details]
% --------------------------------------------------------   

    im_blob = input_blobs{1};
    labels_blob = input_blobs{2};
    label_weights_blob = input_blobs{3};
    bbox_targets_blob = input_blobs{4};
    bbox_loss_weights_blob = input_blobs{5};
    
    % concat anchors as [channel, height, width], where channel is the fastest dimension.
    rois = proposal_locate_anchors(conf, image_roidb.im_size, conf.scales(scale_inds));

    bbox_targets = double(permute(bbox_targets_blob, [3, 2, 1]));
    bbox_targets = reshape(bbox_targets, 4, [])';
    bbox_targets = bsxfun(@times, bbox_targets, bbox_stds);
    bbox_targets = bsxfun(@plus, bbox_targets, bbox_means);
    
    labels_blob = double(permute(labels_blob, [3, 2, 1]));
    labels_blob = labels_blob(:);
    label_weights_blob = double(permute(label_weights_blob, [3, 2, 1]));
    label_weights_blob = label_weights_blob(:);
    pred_boxes = fast_rcnn_bbox_transform_inv(rois, bbox_targets);    

    num_anchors = size(conf.anchors, 1);
    for i = 1:size(im_blob, 4)
       for j = 1:num_anchors
           im = im_blob(:, :, [3, 2, 1], i);
           im = permute(im, [2, 1, 3]);
           imshow(mat2gray(im));
           hold on;
           
           sub_rois = rois(j:num_anchors:end