File size: 2,357 Bytes
a00ee36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
% Copyright (c) Facebook, Inc. and its affiliates.
% All rights reserved.
%
% All contributions by Andy Brock:
% Copyright (c) 2019 Andy Brock
%
% MIT License

clc
clear all
close all
fclose all;



%% Get All logs and sort them
s = {};
d = dir();
j = 1;
for i = 1:length(d)
    if  any(strfind(d(i).name,'.jsonl'))
        s = [s; d(i).name];
    end
end


j = 1;
for i = 1:length(s)
    fname = s{i,1};
    % Check if the Inception metrics log exists, and if so, plot it
    [itr, IS, FID, t] = process_inception_log(fname(1:end - 10), 'log.jsonl');
    s{i,2} = itr;
    s{i,3} = IS;
    s{i,4} = FID;
    s{i,5} = max(IS);
    s{i,6} = min(FID);
    s{i,7} = t;
end
% Sort by Inception Score?
[IS_sorted, IS_index] = sort(cell2mat(s(:,5)));
% Cutoff inception scores below a certain value?
threshold = 22;
IS_index = IS_index(IS_sorted > threshold);

% Sort by FID?
[FID_sorted, FID_index] = sort(cell2mat(s(:,6)));
% Cutoff also based on IS?
% threshold = 0;
FID_index = FID_index(IS_sorted > threshold);



%% Plot things?
cc = hsv(length(IS_index));
legend1 = {};
legend2 = {};
make_axis=true;%false % Turn this on to see the axis out to 1e6 iterations
for i=1:length(IS_index)
    legend1 = [legend1; s{IS_index(i), 1}];
    figure(1)
    plot(s{IS_index(i),2}, s{IS_index(i),3}, 'color', cc(i,:),'linewidth',2)
    hold on;
    xlabel('itr'); ylabel('IS');
    grid on;
    if make_axis
        axis([0,1e6,0,80]); % 50% grid on;
    end
    legend(legend1,'Interpreter','none')
    %pause(1) % Turn this on to animate stuff
    legend2 = [legend2; s{IS_index(i), 1}];
    figure(2)
    plot(s{IS_index(i),2}, s{IS_index(i),4}, 'color', cc(i,:),'linewidth',2)
    hold on;
    xlabel('itr'); ylabel('FID');
    j = j + 1;
    grid on;
    if make_axis
        axis([0,1e6,0,50]);% grid on;
    end
    legend(legend2, 'Interpreter','none')
    
end

%% Quick script to plot IS versus timesteps
if 0
    figure(3);
    this_index=4;
    subplot(2,1,1);
    %plot(s{this_index, 2}(2:end), s{this_index, 7}(2:end) - s{this_index, 7}(1:end-1), 'r*');
    % xlabel('Iteration');ylabel('\Delta T')
    plot(s{this_index, 2}, s{this_index, 7}, 'r*');
    xlabel('Iteration');ylabel('T')
    subplot(2,1,2);
    plot(s{this_index, 2}, s{this_index, 3}, 'r', 'linewidth',2);
    xlabel('Iteration'), ylabel('Inception score')
    title(s{this_index,1})
end