Closed Galaxy-Ding closed 4 months ago
i find the answer at the source code
which is in the file :
api = Namespace('dataset', description='Dataset related operations')
dataset_create = reqparse.RequestParser()
dataset_create.add_argument('name', required=True)
dataset_create.add_argument('categories', type=list, required=False, location='json',
help="List of default categories for sub images")
page_data = reqparse.RequestParser()
page_data.add_argument('page', default=1, type=int)
page_data.add_argument('limit', default=20, type=int)
page_data.add_argument('folder', default='', help='Folder for data')
page_data.add_argument('order', default='file_name', help='Order to display images')
at last my code modify like this:
data = {
'page': 1,
'limit': 100
}
response = requests.get(_url, headers=headers, cookies=AnnatorToken, data=data)
it work for me!
What i use:
Version: v0.11.1
BackGround:
I want to get the IDs of all the images in a dataset via the API in coco-annotator.what i use api like:
but i only can get one page images like:
{"total": 629, "per_page": 20, "pages": 32, "page": 0, "images": [{"id": 54577, "file_name": "_image_2020.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54578, "file_name": "_image_2021.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54579, "file_name": "_image_2022.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54580, "file_name": "_image_2023.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54581, "file_name": "_image_2024.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54582, "file_name": "_image_2025.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54583, "file_name": "_image_2026.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54584, "file_name": "_image_2027.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54585, "file_name": "_image_2028.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54586, "file_name": "_image_2029.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54587, "file_name": "_image_2030.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54588, "file_name": "_image_2031.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54589, "file_name": "_image_2032.jpg", "annotated": false, "annotating": [], "num_annotations": 0}, {"id": 54590, "file_name": "_image_2033.jpg", "annotated": true, "annotating": [], "num_annotations": 4}, {"id": 54591, "file_name": "_image_2034.jpg", "annotated": true, "annotating": [], "num_annotations": 4}, {"id": 54592, "file_name": "_image_2035.jpg", "annotated": true, "annotating": [], "num_annotations": 4}, {"id": 54593, "file_name": "_image_2036.jpg", "annotated": true, "annotating": [], "num_annotations": 4}, {"id": 54594, "file_name": "_image_2037.jpg", "annotated": true, "annotating": [], "num_annotations": 4}, {"id": 54595, "file_name": "_image_2038.jpg", "annotated": true, "annotating": [], "num_annotations": 4}, {"id": 54596, "file_name": "_image_2039.jpg", "annotated": true, "annotating": [], "num_annotations": 4}], "folder": "", "directory": "/datasets/beltdatatest/", "dataset": {"id": 99, "name": "beltdatatest", "directory": "/datasets/beltdatatest/", "categories": [25], "owner": "", "users": [], "annotate_url": "", "default_annotation_metadata": {}, "deleted": false}, "categories": [{"id": 25, "name": "BeltPoints"}], "subdirectories": [], "time_ms": 32}
What I try:
attach "&page=1" on the url, so the url like:
http://10.20.10.18:5000/api/dataset/99/data&page=1
at last it was failed.