Skip to content

Commit

Permalink
Ship detector evaluation label interface (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
asolsonaberga authored Sep 24, 2019
1 parent bd778d4 commit e1ab717
Show file tree
Hide file tree
Showing 9 changed files with 849 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Remoras/Ship-Detector/detection/sh_detector_batch.m
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
filename = split(REMORA.sh.ltsa.infile,'.ltsa');
matname = ['Ship_detections_',filename{1},'.mat'];
settings = REMORA.sh.settings;
% remove padded text
shipLabels(strcmp(shipLabels,'unknown')) = [];
save(fullfile(REMORA.sh.settings.outDir,matname),'shipTimes',...
'shipLabels','settings','-mat','-v7.3');
fprintf('Detections saved at: %s\n',fullfile(REMORA.sh.settings.outDir,matname));
Expand Down
61 changes: 61 additions & 0 deletions Remoras/Ship-Detector/evaluation/sh_draw_ltsa.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
function sh_draw_ltsa(handles)
%
% sh_eval_draw_ltsa.m
%
% Plot ltsa sessions using detections to define sessions

bin2hr = handles.ltsa.tave/(60*60);
boxcolor{1}='r'; % 1 is red
boxcolor{2}='g'; % 2 is green
detNum = handles.ViewStart:(handles.ViewStart+length(handles.markers)-1);

% Change plot frequency axis

[~,low] = min(abs(handles.ltsa.freq-handles.StartFreqVal));
[~,high] = min(abs(handles.ltsa.freq-handles.EndFreqVal));

handles.ltsaData = handles.ltsaData(low:high,:);

c = (100/100) .* handles.ltsaData + handles.brightness*100;
t = (1:size(handles.ltsaData,2))*bin2hr;
image(t,handles.ltsa.f(low:high),c)

axis xy
set(gca,'TickDir','out')

for iDilim = 1:length(handles.markers)-1
hold on
plot([handles.markers(iDilim)*bin2hr,handles.markers(iDilim)*bin2hr],...
[0,handles.EndFreqVal],'w');

% plot rectangles
boxnumber = strcmp(handles.shipLabels{handles.ViewStart+iDilim-1},'ship')+1;

rectangle('Position',[handles.markers(iDilim)*bin2hr,...
handles.EndFreqVal - round(.015*(handles.EndFreqVal-handles.StartFreqVal)),...
handles.markers(iDilim+1)*bin2hr-handles.markers(iDilim)*bin2hr,...
round(.015*(handles.EndFreqVal-handles.StartFreqVal))],...
'FaceColor',boxcolor{boxnumber});

lenNum = length(num2str(detNum(iDilim)));
if lenNum == 2; buff = 0.99;
elseif lenNum == 3; buff = 0.98;
elseif lenNum > 3; buff = 0.97;
else; buff = 1;
end
midPos = ((handles.markers(iDilim+1)*bin2hr+handles.markers(iDilim)*bin2hr)/2)*buff;
if midPos < handles.PlotLengthVal
text(midPos,...
handles.EndFreqVal*1.02,...
num2str(detNum(iDilim)),'FontSize',10,'FontWeight','bold');
else
continue
end

end

hold off




Binary file added Remoras/Ship-Detector/evaluation/sh_evaluate.fig
Binary file not shown.
Loading

0 comments on commit e1ab717

Please sign in to comment.