Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cocoapi
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
National Facility
cocoapi
Commits
a22446f0
Commit
a22446f0
authored
9 years ago
by
pdollar
Browse files
Options
Downloads
Patches
Plain Diff
MatlabAPI/CocoApi.m>download(): can specify maxn images to download
parent
7b445d52
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
MatlabAPI/CocoApi.m
+5
-3
5 additions, 3 deletions
MatlabAPI/CocoApi.m
with
5 additions
and
3 deletions
MatlabAPI/CocoApi.m
+
5
−
3
View file @
a22446f0
...
...
@@ -291,16 +291,18 @@ classdef CocoApi
cdata
.
annotations
=
R
;
cocoRes
=
CocoApi
(
cdata
);
end
function
download
(
coco
,
tarDir
)
function
download
(
coco
,
tarDir
,
maxn
)
% Download COCO images from mscoco.org server.
%
% USAGE
% coco.download( tarDir )
% coco.download( tarDir
, [maxn]
)
%
% INPUTS
% tarDir - COCO results filename
% maxn - maximum number of images to download
fs
=
{
coco
.
data
.
images
.
file_name
};
n
=
length
(
fs
);
urls
=
{
coco
.
data
.
images
.
coco_url
};
do
=
true
(
1
,
n
);
if
(
nargin
==
3
),
n
=
min
(
n
,
maxn
);
end
;
[
fs
,
o
]
=
sort
(
fs
);
urls
=
{
coco
.
data
.
images
.
coco_url
};
urls
=
urls
(
o
);
do
=
true
(
1
,
n
);
for
i
=
1
:
n
,
fs
{
i
}
=
[
tarDir
'/'
fs
{
i
}];
do
(
i
)
=~
exist
(
fs
{
i
},
'file'
);
end
fs
=
fs
(
do
);
urls
=
urls
(
do
);
n
=
length
(
fs
);
if
(
n
==
0
),
return
;
end
if
(
~
exist
(
tarDir
,
'dir'
)),
mkdir
(
tarDir
);
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment