forked from qizhuli/Weakly-Supervised-Panoptic-Segmentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_merge_cam_mandg.m
50 lines (46 loc) · 1.75 KB
/
demo_merge_cam_mandg.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% ------------------------------------------------------------------------
% Copyright (C)
% Torr Vision Group (TVG)
% University of Oxford - UK
%
% Qizhu Li <[email protected]>
% August 2018
% ------------------------------------------------------------------------
% This file is part of the weakly-supervised training method presented in:
% Qizhu Li*, Anurag Arnab*, Philip H.S. Torr,
% "Weakly- and Semi-Supervised Panoptic Segmentation,"
% European Conference on Computer Vision (ECCV) 2018.
% Please consider citing the paper if you use this code.
% ------------------------------------------------------------------------
% This script demos generation of iterative ground truths for weakly-
% supervised experiments.
%
% It merges CAM predictions with MCG&Grabcut masks to produce GT for
% the first round of iterative training.
% INPUT:
% - results/cam/<split>/*.png: the CAMs obtained from a multi-class
% classifier.
% - results/mcg_and_grabcut/<split>/*.png: the combined cues from MCG
% and Grabcut.
% ------------------------------------------------------------------------
clearvars;
addpath scripts
addpath utils
addpath visualisation
% Extract detections from Cityscapes ground truth file and save as .mat
% this only need to be done once, as they do not change over iterative
% training stages
demo_instanceTrainId_to_dets;
clearvars;
dataset = 'cityscapes';
split = 'train';
opts = get_opts(dataset, split);
opts.list_path = 'lists/demo_id.txt';
opts.pred_dir = fullfile('cam', split);
opts.sem_save_dir = 'pred_sem_cam_mandg_merged';
opts.ins_save_dir = 'pred_ins_cam_mandg_merged';
opts.run_score_thresh = false;
opts.visualise_results = true;
[opts, results] = run_sub(opts);
% visualise
visualise_results_cam_mandg(opts, results);