|
|
|
@ -17,6 +17,7 @@ from glob import glob
|
|
|
|
from io import BytesIO
|
|
|
|
from io import BytesIO
|
|
|
|
from unittest import mock
|
|
|
|
from unittest import mock
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
|
|
|
|
import copy
|
|
|
|
|
|
|
|
|
|
|
|
import av
|
|
|
|
import av
|
|
|
|
import numpy as np
|
|
|
|
import numpy as np
|
|
|
|
@ -3095,7 +3096,12 @@ def generate_manifest_file(data_type, manifest_path, sources):
|
|
|
|
manifest.create()
|
|
|
|
manifest.create()
|
|
|
|
|
|
|
|
|
|
|
|
class TaskDataAPITestCase(APITestCase):
|
|
|
|
class TaskDataAPITestCase(APITestCase):
|
|
|
|
_image_sizes = {}
|
|
|
|
_share_image_sizes = {}
|
|
|
|
|
|
|
|
_client_images = {}
|
|
|
|
|
|
|
|
_client_mp4_video = {}
|
|
|
|
|
|
|
|
_client_archive = {}
|
|
|
|
|
|
|
|
_client_pdf = {}
|
|
|
|
|
|
|
|
_client_mxf_video = {}
|
|
|
|
|
|
|
|
|
|
|
|
class ChunkType(str, Enum):
|
|
|
|
class ChunkType(str, Enum):
|
|
|
|
IMAGESET = 'imageset'
|
|
|
|
IMAGESET = 'imageset'
|
|
|
|
@ -3119,28 +3125,28 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
image.write(data.read())
|
|
|
|
image.write(data.read())
|
|
|
|
cls._image_sizes[filename] = img_size
|
|
|
|
cls._share_image_sizes[filename] = img_size
|
|
|
|
|
|
|
|
|
|
|
|
filename = "test_2.jpg"
|
|
|
|
filename = "test_2.jpg"
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
image.write(data.read())
|
|
|
|
image.write(data.read())
|
|
|
|
cls._image_sizes[filename] = img_size
|
|
|
|
cls._share_image_sizes[filename] = img_size
|
|
|
|
|
|
|
|
|
|
|
|
filename = "test_3.jpg"
|
|
|
|
filename = "test_3.jpg"
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
image.write(data.read())
|
|
|
|
image.write(data.read())
|
|
|
|
cls._image_sizes[filename] = img_size
|
|
|
|
cls._share_image_sizes[filename] = img_size
|
|
|
|
|
|
|
|
|
|
|
|
filename = "test_10.jpg"
|
|
|
|
filename = "test_10.jpg"
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
image.write(data.read())
|
|
|
|
image.write(data.read())
|
|
|
|
cls._image_sizes[filename] = img_size
|
|
|
|
cls._share_image_sizes[filename] = img_size
|
|
|
|
|
|
|
|
|
|
|
|
filename = os.path.join("data", "test_3.jpg")
|
|
|
|
filename = os.path.join("data", "test_3.jpg")
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
@ -3148,14 +3154,14 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
img_size, data = generate_image_file(filename)
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
with open(path, "wb") as image:
|
|
|
|
image.write(data.read())
|
|
|
|
image.write(data.read())
|
|
|
|
cls._image_sizes[filename] = img_size
|
|
|
|
cls._share_image_sizes[filename] = img_size
|
|
|
|
|
|
|
|
|
|
|
|
filename = "test_video_1.mp4"
|
|
|
|
filename = "test_video_1.mp4"
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
img_sizes, data = generate_video_file(filename, width=1280, height=720)
|
|
|
|
img_sizes, data = generate_video_file(filename, width=1280, height=720)
|
|
|
|
with open(path, "wb") as video:
|
|
|
|
with open(path, "wb") as video:
|
|
|
|
video.write(data.read())
|
|
|
|
video.write(data.read())
|
|
|
|
cls._image_sizes[filename] = img_sizes
|
|
|
|
cls._share_image_sizes[filename] = img_sizes
|
|
|
|
|
|
|
|
|
|
|
|
filename = "test_rotated_90_video.mp4"
|
|
|
|
filename = "test_rotated_90_video.mp4"
|
|
|
|
path = os.path.join(os.path.dirname(__file__), 'assets', 'test_rotated_90_video.mp4')
|
|
|
|
path = os.path.join(os.path.dirname(__file__), 'assets', 'test_rotated_90_video.mp4')
|
|
|
|
@ -3165,7 +3171,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
img_sizes = [(frame.height, frame.width)] * container.streams.video[0].frames
|
|
|
|
img_sizes = [(frame.height, frame.width)] * container.streams.video[0].frames
|
|
|
|
break
|
|
|
|
break
|
|
|
|
container.close()
|
|
|
|
container.close()
|
|
|
|
cls._image_sizes[filename] = img_sizes
|
|
|
|
cls._share_image_sizes[filename] = img_sizes
|
|
|
|
|
|
|
|
|
|
|
|
filename = os.path.join("videos", "test_video_1.mp4")
|
|
|
|
filename = os.path.join("videos", "test_video_1.mp4")
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
@ -3173,14 +3179,14 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
img_sizes, data = generate_video_file(filename, width=1280, height=720)
|
|
|
|
img_sizes, data = generate_video_file(filename, width=1280, height=720)
|
|
|
|
with open(path, "wb") as video:
|
|
|
|
with open(path, "wb") as video:
|
|
|
|
video.write(data.read())
|
|
|
|
video.write(data.read())
|
|
|
|
cls._image_sizes[filename] = img_sizes
|
|
|
|
cls._share_image_sizes[filename] = img_sizes
|
|
|
|
|
|
|
|
|
|
|
|
filename = os.path.join("test_archive_1.zip")
|
|
|
|
filename = os.path.join("test_archive_1.zip")
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, filename)
|
|
|
|
img_sizes, data = generate_zip_archive_file(filename, count=5)
|
|
|
|
img_sizes, data = generate_zip_archive_file(filename, count=5)
|
|
|
|
with open(path, "wb") as zip_archive:
|
|
|
|
with open(path, "wb") as zip_archive:
|
|
|
|
zip_archive.write(data.read())
|
|
|
|
zip_archive.write(data.read())
|
|
|
|
cls._image_sizes[filename] = img_sizes
|
|
|
|
cls._share_image_sizes[filename] = img_sizes
|
|
|
|
|
|
|
|
|
|
|
|
filename = "test_pointcloud_pcd.zip"
|
|
|
|
filename = "test_pointcloud_pcd.zip"
|
|
|
|
path = os.path.join(os.path.dirname(__file__), 'assets', filename)
|
|
|
|
path = os.path.join(os.path.dirname(__file__), 'assets', filename)
|
|
|
|
@ -3192,7 +3198,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
with zip_file.open(info, "r") as file:
|
|
|
|
with zip_file.open(info, "r") as file:
|
|
|
|
data = ValidateDimension.get_pcd_properties(file)
|
|
|
|
data = ValidateDimension.get_pcd_properties(file)
|
|
|
|
image_sizes.append((int(data["WIDTH"]), int(data["HEIGHT"])))
|
|
|
|
image_sizes.append((int(data["WIDTH"]), int(data["HEIGHT"])))
|
|
|
|
cls._image_sizes[filename] = image_sizes
|
|
|
|
cls._share_image_sizes[filename] = image_sizes
|
|
|
|
|
|
|
|
|
|
|
|
filename = "test_velodyne_points.zip"
|
|
|
|
filename = "test_velodyne_points.zip"
|
|
|
|
path = os.path.join(os.path.dirname(__file__), 'assets', filename)
|
|
|
|
path = os.path.join(os.path.dirname(__file__), 'assets', filename)
|
|
|
|
@ -3221,14 +3227,14 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
root_path = os.path.abspath(os.path.join(root_path, filename.split(".")[0]))
|
|
|
|
root_path = os.path.abspath(os.path.join(root_path, filename.split(".")[0]))
|
|
|
|
|
|
|
|
|
|
|
|
shutil.rmtree(root_path)
|
|
|
|
shutil.rmtree(root_path)
|
|
|
|
cls._image_sizes[filename] = image_sizes
|
|
|
|
cls._share_image_sizes[filename] = image_sizes
|
|
|
|
|
|
|
|
|
|
|
|
file_name = 'test_1.pdf'
|
|
|
|
file_name = 'test_1.pdf'
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, file_name)
|
|
|
|
path = os.path.join(settings.SHARE_ROOT, file_name)
|
|
|
|
img_sizes, data = generate_pdf_file(file_name, page_count=5)
|
|
|
|
img_sizes, data = generate_pdf_file(file_name, page_count=5)
|
|
|
|
with open(path, "wb") as pdf_file:
|
|
|
|
with open(path, "wb") as pdf_file:
|
|
|
|
pdf_file.write(data.read())
|
|
|
|
pdf_file.write(data.read())
|
|
|
|
cls._image_sizes[file_name] = img_sizes
|
|
|
|
cls._share_image_sizes[file_name] = img_sizes
|
|
|
|
|
|
|
|
|
|
|
|
generate_manifest_file(data_type='video', manifest_path=os.path.join(settings.SHARE_ROOT, 'videos', 'manifest.jsonl'),
|
|
|
|
generate_manifest_file(data_type='video', manifest_path=os.path.join(settings.SHARE_ROOT, 'videos', 'manifest.jsonl'),
|
|
|
|
sources=[os.path.join(settings.SHARE_ROOT, 'videos', 'test_video_1.mp4')])
|
|
|
|
sources=[os.path.join(settings.SHARE_ROOT, 'videos', 'test_video_1.mp4')])
|
|
|
|
@ -3236,6 +3242,36 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
generate_manifest_file(data_type='images', manifest_path=os.path.join(settings.SHARE_ROOT, 'manifest.jsonl'),
|
|
|
|
generate_manifest_file(data_type='images', manifest_path=os.path.join(settings.SHARE_ROOT, 'manifest.jsonl'),
|
|
|
|
sources=[os.path.join(settings.SHARE_ROOT, f'test_{i}.jpg') for i in range(1,4)])
|
|
|
|
sources=[os.path.join(settings.SHARE_ROOT, f'test_{i}.jpg') for i in range(1,4)])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, images = generate_image_files("test_1.jpg", "test_2.jpg", "test_3.jpg")
|
|
|
|
|
|
|
|
cls._client_images = {
|
|
|
|
|
|
|
|
'images': images,
|
|
|
|
|
|
|
|
'image_sizes': image_sizes,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, video = generate_video_file(filename="test_video_1.mp4", width=1280, height=720)
|
|
|
|
|
|
|
|
cls._client_mp4_video = {
|
|
|
|
|
|
|
|
'video': video,
|
|
|
|
|
|
|
|
'image_sizes': image_sizes,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, archive = generate_zip_archive_file("test_archive_2.zip", 7)
|
|
|
|
|
|
|
|
cls._client_archive = {
|
|
|
|
|
|
|
|
'archive': archive,
|
|
|
|
|
|
|
|
'image_sizes': image_sizes
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, document = generate_pdf_file("test_pdf_1.pdf", 5)
|
|
|
|
|
|
|
|
cls._client_pdf = {
|
|
|
|
|
|
|
|
'pdf': document,
|
|
|
|
|
|
|
|
'image_sizes': image_sizes
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, video = generate_video_file(filename="test_video_1.mxf", width=1280, height=720, codec_name='mpeg2video')
|
|
|
|
|
|
|
|
cls._client_mxf_video = {
|
|
|
|
|
|
|
|
'video': video,
|
|
|
|
|
|
|
|
'image_sizes': image_sizes,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
|
def tearDownClass(cls):
|
|
|
|
def tearDownClass(cls):
|
|
|
|
super().tearDownClass()
|
|
|
|
super().tearDownClass()
|
|
|
|
@ -3296,7 +3332,9 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
return self.client.get(url)
|
|
|
|
return self.client.get(url)
|
|
|
|
|
|
|
|
|
|
|
|
def _get_preview(self, tid, user):
|
|
|
|
def _get_preview(self, tid, user):
|
|
|
|
return self._run_api_v2_task_id_data_get(tid, user, "preview")
|
|
|
|
url = '/api/tasks/{}/preview'.format(tid)
|
|
|
|
|
|
|
|
with ForceLogin(user, self.client):
|
|
|
|
|
|
|
|
return self.client.get(url)
|
|
|
|
|
|
|
|
|
|
|
|
def _get_compressed_chunk(self, tid, user, number):
|
|
|
|
def _get_compressed_chunk(self, tid, user, number):
|
|
|
|
return self._run_api_v2_task_id_data_get(tid, user, "chunk", "compressed", number)
|
|
|
|
return self._run_api_v2_task_id_data_get(tid, user, "chunk", "compressed", number)
|
|
|
|
@ -3364,7 +3402,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
self.assertEqual(response.status_code, expected_status_code)
|
|
|
|
self.assertEqual(response.status_code, expected_status_code)
|
|
|
|
if expected_status_code == status.HTTP_200_OK:
|
|
|
|
if expected_status_code == status.HTTP_200_OK:
|
|
|
|
if dimension == DimensionType.DIM_2D:
|
|
|
|
if dimension == DimensionType.DIM_2D:
|
|
|
|
preview = Image.open(io.BytesIO(b"".join(response.streaming_content)))
|
|
|
|
preview = Image.open(io.BytesIO(response.content))
|
|
|
|
self.assertLessEqual(preview.size, image_sizes[0])
|
|
|
|
self.assertLessEqual(preview.size, image_sizes[0])
|
|
|
|
|
|
|
|
|
|
|
|
# check compressed chunk
|
|
|
|
# check compressed chunk
|
|
|
|
@ -3458,7 +3496,8 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, images = generate_image_files("test_1.jpg", "test_2.jpg", "test_3.jpg")
|
|
|
|
images = copy.deepcopy(self._client_images['images'])
|
|
|
|
|
|
|
|
image_sizes = self._client_images['image_sizes']
|
|
|
|
task_data = {
|
|
|
|
task_data = {
|
|
|
|
"client_files[0]": images[0],
|
|
|
|
"client_files[0]": images[0],
|
|
|
|
"client_files[1]": images[1],
|
|
|
|
"client_files[1]": images[1],
|
|
|
|
@ -3486,10 +3525,10 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"image_quality": 75,
|
|
|
|
"image_quality": 75,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = [
|
|
|
|
image_sizes = [
|
|
|
|
self._image_sizes[task_data["server_files[3]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[3]"]],
|
|
|
|
self._image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._image_sizes[task_data["server_files[2]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[2]"]],
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET, image_sizes,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET, image_sizes,
|
|
|
|
@ -3509,7 +3548,8 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
{"name": "person"},
|
|
|
|
{"name": "person"},
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes, video = generate_video_file(filename="test_video_1.mp4", width=1280, height=720)
|
|
|
|
video = copy.deepcopy(self._client_mp4_video['video'])
|
|
|
|
|
|
|
|
image_sizes = self._client_mp4_video['image_sizes']
|
|
|
|
task_data = {
|
|
|
|
task_data = {
|
|
|
|
"client_files[0]": video,
|
|
|
|
"client_files[0]": video,
|
|
|
|
"image_quality": 43,
|
|
|
|
"image_quality": 43,
|
|
|
|
@ -3531,7 +3571,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"server_files[0]": "test_video_1.mp4",
|
|
|
|
"server_files[0]": "test_video_1.mp4",
|
|
|
|
"image_quality": 57,
|
|
|
|
"image_quality": 57,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = self._image_sizes[task_data["server_files[0]"]]
|
|
|
|
image_sizes = self._share_image_sizes[task_data["server_files[0]"]]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.VIDEO, self.ChunkType.VIDEO, image_sizes,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.VIDEO, self.ChunkType.VIDEO, image_sizes,
|
|
|
|
expected_uploaded_data_location=StorageChoice.SHARE)
|
|
|
|
expected_uploaded_data_location=StorageChoice.SHARE)
|
|
|
|
@ -3554,7 +3594,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"server_files[0]": os.path.join("videos", "test_video_1.mp4"),
|
|
|
|
"server_files[0]": os.path.join("videos", "test_video_1.mp4"),
|
|
|
|
"image_quality": 57,
|
|
|
|
"image_quality": 57,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = self._image_sizes[task_data["server_files[0]"]]
|
|
|
|
image_sizes = self._share_image_sizes[task_data["server_files[0]"]]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.VIDEO, self.ChunkType.VIDEO, image_sizes,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.VIDEO, self.ChunkType.VIDEO, image_sizes,
|
|
|
|
expected_uploaded_data_location=StorageChoice.SHARE)
|
|
|
|
expected_uploaded_data_location=StorageChoice.SHARE)
|
|
|
|
@ -3579,7 +3619,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"image_quality": 12,
|
|
|
|
"image_quality": 12,
|
|
|
|
"use_zip_chunks": True,
|
|
|
|
"use_zip_chunks": True,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = self._image_sizes[task_data["server_files[0]"]]
|
|
|
|
image_sizes = self._share_image_sizes[task_data["server_files[0]"]]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.VIDEO, image_sizes,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.VIDEO, image_sizes,
|
|
|
|
expected_uploaded_data_location=StorageChoice.SHARE)
|
|
|
|
expected_uploaded_data_location=StorageChoice.SHARE)
|
|
|
|
@ -3602,7 +3642,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"server_files[0]": "test_archive_1.zip",
|
|
|
|
"server_files[0]": "test_archive_1.zip",
|
|
|
|
"image_quality": 88,
|
|
|
|
"image_quality": 88,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = self._image_sizes[task_data["server_files[0]"]]
|
|
|
|
image_sizes = self._share_image_sizes[task_data["server_files[0]"]]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET, image_sizes,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET, image_sizes,
|
|
|
|
expected_uploaded_data_location=StorageChoice.LOCAL)
|
|
|
|
expected_uploaded_data_location=StorageChoice.LOCAL)
|
|
|
|
@ -3621,7 +3661,8 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
{"name": "person"},
|
|
|
|
{"name": "person"},
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes, archive = generate_zip_archive_file("test_archive_2.zip", 7)
|
|
|
|
archive = copy.deepcopy(self._client_archive['archive'])
|
|
|
|
|
|
|
|
image_sizes = self._client_archive['image_sizes']
|
|
|
|
task_data = {
|
|
|
|
task_data = {
|
|
|
|
"client_files[0]": archive,
|
|
|
|
"client_files[0]": archive,
|
|
|
|
"image_quality": 100,
|
|
|
|
"image_quality": 100,
|
|
|
|
@ -3645,7 +3686,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"use_cache": True,
|
|
|
|
"use_cache": True,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes = self._image_sizes[task_data["server_files[0]"]]
|
|
|
|
image_sizes = self._share_image_sizes[task_data["server_files[0]"]]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.VIDEO,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.VIDEO,
|
|
|
|
self.ChunkType.VIDEO, image_sizes, StorageMethodChoice.CACHE, StorageChoice.SHARE)
|
|
|
|
self.ChunkType.VIDEO, image_sizes, StorageMethodChoice.CACHE, StorageChoice.SHARE)
|
|
|
|
@ -3673,9 +3714,9 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"use_cache": True,
|
|
|
|
"use_cache": True,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = [
|
|
|
|
image_sizes = [
|
|
|
|
self._image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._image_sizes[task_data["server_files[2]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[2]"]],
|
|
|
|
self._image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[1]"]],
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
@ -3702,7 +3743,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"use_cache": True
|
|
|
|
"use_cache": True
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes = self._image_sizes[task_data["server_files[0]"]]
|
|
|
|
image_sizes = self._share_image_sizes[task_data["server_files[0]"]]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self.ChunkType.IMAGESET, image_sizes, StorageMethodChoice.CACHE, StorageChoice.LOCAL)
|
|
|
|
self.ChunkType.IMAGESET, image_sizes, StorageMethodChoice.CACHE, StorageChoice.LOCAL)
|
|
|
|
@ -3722,7 +3763,8 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, document = generate_pdf_file("test_pdf_1.pdf", 5)
|
|
|
|
document = copy.deepcopy(self._client_pdf['pdf'])
|
|
|
|
|
|
|
|
image_sizes = self._client_pdf['image_sizes']
|
|
|
|
|
|
|
|
|
|
|
|
task_data = {
|
|
|
|
task_data = {
|
|
|
|
"client_files[0]": document,
|
|
|
|
"client_files[0]": document,
|
|
|
|
@ -3744,8 +3786,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, document = generate_pdf_file("test_pdf_2.pdf", 4)
|
|
|
|
document = copy.deepcopy(self._client_pdf['pdf'])
|
|
|
|
|
|
|
|
|
|
|
|
task_data = {
|
|
|
|
task_data = {
|
|
|
|
"client_files[0]": document,
|
|
|
|
"client_files[0]": document,
|
|
|
|
"image_quality": 70,
|
|
|
|
"image_quality": 70,
|
|
|
|
@ -3769,7 +3810,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"image_quality": 70,
|
|
|
|
"image_quality": 70,
|
|
|
|
"use_cache": True
|
|
|
|
"use_cache": True
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = self._image_sizes[task_data['server_files[0]']]
|
|
|
|
image_sizes = self._share_image_sizes[task_data['server_files[0]']]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.VIDEO,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.VIDEO,
|
|
|
|
self.ChunkType.VIDEO, image_sizes, StorageMethodChoice.CACHE,
|
|
|
|
self.ChunkType.VIDEO, image_sizes, StorageMethodChoice.CACHE,
|
|
|
|
@ -3796,7 +3837,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"use_zip_chunks": True
|
|
|
|
"use_zip_chunks": True
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes = self._image_sizes['test_rotated_90_video.mp4']
|
|
|
|
image_sizes = self._share_image_sizes['test_rotated_90_video.mp4']
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self.ChunkType.VIDEO, image_sizes, StorageMethodChoice.FILE_SYSTEM)
|
|
|
|
self.ChunkType.VIDEO, image_sizes, StorageMethodChoice.FILE_SYSTEM)
|
|
|
|
|
|
|
|
|
|
|
|
@ -3817,7 +3858,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"use_zip_chunks": True
|
|
|
|
"use_zip_chunks": True
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes = self._image_sizes['test_rotated_90_video.mp4']
|
|
|
|
image_sizes = self._share_image_sizes['test_rotated_90_video.mp4']
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self.ChunkType.VIDEO, image_sizes, StorageMethodChoice.CACHE)
|
|
|
|
self.ChunkType.VIDEO, image_sizes, StorageMethodChoice.CACHE)
|
|
|
|
|
|
|
|
|
|
|
|
@ -3830,7 +3871,8 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
],
|
|
|
|
],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
image_sizes, video = generate_video_file(filename="test_video_1.mxf", width=1280, height=720, codec_name='mpeg2video')
|
|
|
|
video = copy.deepcopy(self._client_mxf_video['video'])
|
|
|
|
|
|
|
|
image_sizes = self._client_mxf_video['image_sizes']
|
|
|
|
task_data = {
|
|
|
|
task_data = {
|
|
|
|
"client_files[0]": video,
|
|
|
|
"client_files[0]": video,
|
|
|
|
"image_quality": 51,
|
|
|
|
"image_quality": 51,
|
|
|
|
@ -3852,7 +3894,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"client_files[0]": open(os.path.join(os.path.dirname(__file__), 'assets', 'test_pointcloud_pcd.zip'), 'rb'),
|
|
|
|
"client_files[0]": open(os.path.join(os.path.dirname(__file__), 'assets', 'test_pointcloud_pcd.zip'), 'rb'),
|
|
|
|
"image_quality": 100,
|
|
|
|
"image_quality": 100,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = self._image_sizes["test_pointcloud_pcd.zip"]
|
|
|
|
image_sizes = self._share_image_sizes["test_pointcloud_pcd.zip"]
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self.ChunkType.IMAGESET,
|
|
|
|
self.ChunkType.IMAGESET,
|
|
|
|
image_sizes, dimension=DimensionType.DIM_3D)
|
|
|
|
image_sizes, dimension=DimensionType.DIM_3D)
|
|
|
|
@ -3872,7 +3914,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
'rb'),
|
|
|
|
'rb'),
|
|
|
|
"image_quality": 100,
|
|
|
|
"image_quality": 100,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = self._image_sizes["test_velodyne_points.zip"]
|
|
|
|
image_sizes = self._share_image_sizes["test_velodyne_points.zip"]
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET,
|
|
|
|
self.ChunkType.IMAGESET,
|
|
|
|
self.ChunkType.IMAGESET,
|
|
|
|
image_sizes, dimension=DimensionType.DIM_3D)
|
|
|
|
image_sizes, dimension=DimensionType.DIM_3D)
|
|
|
|
@ -3896,9 +3938,9 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"use_cache": True
|
|
|
|
"use_cache": True
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = [
|
|
|
|
image_sizes = [
|
|
|
|
self._image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._image_sizes[task_data["server_files[2]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[2]"]],
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET,
|
|
|
|
@ -3920,9 +3962,9 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"sorting_method": SortingMethod.PREDEFINED
|
|
|
|
"sorting_method": SortingMethod.PREDEFINED
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = [
|
|
|
|
image_sizes = [
|
|
|
|
self._image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._image_sizes[task_data["server_files[2]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[2]"]],
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET,
|
|
|
|
@ -3939,9 +3981,9 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"sorting_method": SortingMethod.NATURAL
|
|
|
|
"sorting_method": SortingMethod.NATURAL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = [
|
|
|
|
image_sizes = [
|
|
|
|
self._image_sizes[task_data["server_files[2]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[2]"]],
|
|
|
|
self._image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[1]"]],
|
|
|
|
self._image_sizes[task_data["server_files[0]"]],
|
|
|
|
self._share_image_sizes[task_data["server_files[0]"]],
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET,
|
|
|
|
@ -3954,7 +3996,7 @@ class TaskDataAPITestCase(APITestCase):
|
|
|
|
"copy_data": False,
|
|
|
|
"copy_data": False,
|
|
|
|
"use_cache": True,
|
|
|
|
"use_cache": True,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image_sizes = self._image_sizes[task_data["server_files[0]"]]
|
|
|
|
image_sizes = self._share_image_sizes[task_data["server_files[0]"]]
|
|
|
|
|
|
|
|
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET,
|
|
|
|
self._test_api_v2_tasks_id_data_spec(user, task_spec, task_data, self.ChunkType.IMAGESET, self.ChunkType.IMAGESET,
|
|
|
|
image_sizes, StorageMethodChoice.CACHE, StorageChoice.LOCAL)
|
|
|
|
image_sizes, StorageMethodChoice.CACHE, StorageChoice.LOCAL)
|
|
|
|
|