-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data streaming using chunks #1007
Merged
Merged
Changes from 1 commit
Commits
Show all changes
217 commits
Select commit
Hold shift + click to select a range
accc88b
add video stream feature
a048e4a
fix vscode settings
fcdb153
fix server part
54b2625
fix server part
403ccff
fix check is_ node part in frames.js
d18c69e
remove unnessosary modules. replave cvat-data with mini version
17d38a6
delete pttjpeg.js, update package-lock
e6eb0ce
add cvat-data to Dockerfile for tests
ea757cf
fising
f2a11ab
fix pr comments
043c625
fix pr comments
b7f8971
fix pr comments
6663dc8
delete unnecessary cvat-data.min.js
8eab70d
fix docs
5a28f81
fix problem with preview loading
be75b7e
fix deleting old frames, update files to min version
6b583ff
commit unpatched 3rdparty src and update diff
07863cd
tar -> zip
ab48d82
fixed config.backendAPI value for annotationUI
e810538
added new models, migrations
63155bc
updated cvat-core min
4326292
fixes
b3f9d58
fixes & create preview in migration
12305ec
fixed annotation layout
3eaf4dc
merge with last develop
69aa8a5
Merge pull request #1 from ygnn123/yg/mbranch
ygnn123 3ad96a5
extract frames form video by pyAV
572aa17
fixed start, stop , step filters for video
8deca39
save original images
d8eb30f
delete Data object if it has no related tasks
c05ca63
several fixes
dc42963
fix problems with idling loading, fix shift method
3e14f11
fix problem with last frame
5b8cc0b
fix problems with zip-images
a5791a4
Merge pull request #2 from ygnn123/yg/mbranch
ygnn123 ca0c694
fix merging problems
a2799db
Merge pull request #3 from ygnn123/yg/mbranch
ygnn123 f168b65
Merge branch 'develop' into develop
ygnn123 f879828
fix dockerfile
08fd03a
unified paths in image meta
98210b7
fixed pdf extractor
3e81d5d
Added migration for the auto_annotation models
4fdcbbe
copy -> move
6593435
Merge remote-tracking branch 'origin/develop' into az/migration
369a1bd
fixed migration
05b0004
decode frames based on chunk type
e7af854
try catch for migration
4b71c63
fixed build of cvat ui container
61ab2c6
migration improvement
c52be5a
fixed image drawing for annotation mode
f0ef4cc
Merge pull request #5 from azhavoro/fix_annotation_mode
ygnn123 2dc3211
fix problems with image play idle
6da262b
Merge pull request #4 from azhavoro/cvat_az_migration
ygnn123 033b635
fixed unit tests
41ca049
Merge pull request #6 from azhavoro/az/fix_unittests
ygnn123 7e0ee34
fix chunk loading
ec7bfaf
VideoExtractor:filter video stream only
a79455e
wip
b2050ec
working sample
5af9dd4
video media extractor: remove ffmpy and encode video chunks directly via
950e751
fixed import of MP4Reader
151651c
using worker for decoder
61fa2d0
cleanup
5e7488a
fix last frame loss
ea69acf
recompile decoder to increase memory size
2a58cbd
performance logs
c86bd85
fix filters
19103a2
fixed Broadway YUV->RGBA conversation
3539872
fixed preview creating
b5607ed
asm.js -> wasm
025506e
added cropImage function
9a2c04e
added mimetype for wasm ext
87cb87a
set crf=10 for original chunks
38ef91d
Merge remote-tracking branch 'develop' into h264
acbeb87
missed Decoder.js
600fef7
downscale compressed video chunks
ccdaf6d
move upscale to player (it works much faster)
75b8dde
two chunk types
6df2ed3
added flag to create tasks with zip chunks for video data
e5c1c86
fixed player
b644989
wip
5a9f335
couple of fixes
8a0ace3
uncomment downscaling
0511b6a
fixed player
776b6ed
removed comments
f75db83
fixed cleanup method
7c18c40
little code refactoring
dc6c319
added decoded frames cache limits
79bb02a
wip
3ca071c
added filtering of data chunk requests, fixes
e781938
fixed onmessage handler for archives
ffa0344
wip
4159269
refactored media_extractors
e0cda34
added zip media reader
abedac5
added direct zip reader
6a78dee
direct access to frames
b746e8d
changed REST API endpoints to get chunks, frames and preview. Also
2f112e0
removed jsmpeg
5720d73
enable cli tests,
3ae467a
merge cvat_develop into develop
ee8a74d
Merge remote-tracking branch 'cvat_dev/develop' into develop
387a6af
fixed auto_segmentation
388cb0c
fixed reid application
de80790
fixed datumaro
1ef8c9b
wip
9a691f5
Merge remote-tracking branch 'cvat_dev/develop' into develop
a1da83d
wip
ccbda7d
wip
1f25caa
added frame buffer
be881e8
Merge branch 'h264_frame_buffer' into develop
8cf272e
fix codacy issues
6da5100
fix codacy issues part1
7f01b6a
fix codacy issues part2
7c26da9
fix codacy issues part3
38503c7
fix codacy issues part4
60483a8
fix codacy issues part5
96f0dce
fix codacy issues part6
f00001f
fix codacy issues part7
375ef75
fix codacy issues part8
0c55566
fixed build
8ccb940
fixed incorect frameNumber resolve
2d7f075
fixed tests
8d46ec0
removed 'cache' form Data's path
5bb9062
re-enabled fast rewind
6d651b4
fixed tests
bb2360c
Merge branch 'yg_develop' into az/data_chunk_streaming
6d826c3
changed file mode
bd358bd
added build instructions for avc.wasm and Decoder.jsOD
dbb6c77
fixed migration
388c8f3
removed empty test file
155ca90
Don't throw exceptions in rq_hanlder
c70927c
improved migration logging
9b1b8ca
improved unzip_img && other fixes
b7512b1
fixed stop frame filtering
eee228c
fixed meta
080efd6
fixed play/pause
983a936
fixed stdout&stderr redirect
a010e73
suspicious tasks processing
952db8b
Merge branch 'az/data_chunk_streaming' of https://github.com/opencv/c…
4f7084f
fixed codacy issues
246e5fe
changed api of frame_provider
bdf8647
added DataMetaSerializer
68cab82
fixed mock data
079ce24
fixed comments: webpack.config.js
52203b5
improved frame buffer size estimation
3a4fdc7
improved playing
f81a54d
removed unnecessary comment, added checkbox to force zip chunks
2b50667
wip
4bc0fad
enabled preloading
e051be6
refactoring
07cd211
update contributing.md
28ac3d4
fix
5d20196
added swagger schema
ebd6331
removed get_task_datumaro_dirname
637fa97
fixed comments
e05492f
Merge remote-tracking branch 'cvat_dev/develop' into az/data_chunk_st…
c40e84c
fixed comments
4ea82fa
update cvat-core
7a63ce0
improved buffer
20e9bb6
Merge remote-tracking branch 'cvat_dev/develop' into az/data_chunk_st…
6d3f05c
fix buffer logic
9993524
minor improvenment
23f685c
added missed dependencies
dc33d08
print traceback in migration logs
3305a00
unitests
ba44c94
minor improvement
b58d997
fixed some codacy issues, copy eslint config from cvat-core
98af4f8
Merge remote-tracking branch 'cvat_dev/develop' into az/data_chunk_st…
d0e3876
minor fix
60bf233
revert some codacy changes
3bb5b2d
Merge remote-tracking branch 'cvat_dev/develop' into az/data_chunk_st…
e720d4f
Merge remote-tracking branch 'origin/develop' into az/data_chunk_stre…
d73bf4f
codacy
d628265
Merge remote-tracking branch 'origin/develop' into az/data_chunk_stre…
d854493
parallel version of migration
dddd4eb
Merge remote-tracking branch 'origin/develop' into az/data_chunk_stre…
065f2d1
fixed propagation & copy object
fbdc740
fixed upload annotation in case of frame step != 1
f1b0ebb
fixed upload annotation in case of attribute value is empty
1368e46
Merge remote-tracking branch 'origin/develop' into az/data_chunk_stre…
7f54d4e
code style
d545689
=== npm audit security report for cvat-data ===
8126163
Fixed built
bsekachev 7818321
npm audit for cvat-ui was fixed.
f1868ff
Merge remote-tracking branch 'origin/bs/fix_canvas_built' into az/dat…
b9b7cb9
Merge remote-tracking branch 'origin/bs/fix_canvas_built' into az/dat…
d7adb74
Fix cvat-canvas build and npm audit for the library.
91737b6
couple of fixes
53f0f40
added chunk size option to create task UI
db70a2a
fixed dump
9e09cc1
Merge branch 'az/data_chunk_streaming' of https://github.com/opencv/c…
1c1a7ba
Merge remote-tracking branch 'origin/develop' into az/data_chunk_stre…
1c075ea
fixed start chunk frame calculation & z_order
743f0c0
added download chunk worker & couple of fixes
1ef8ace
Merge remote-tracking branch 'origin/develop' into az/data_chunk_stre…
8694fef
fixed export as dataset
7ccb52c
enable buffering for play in new UI
4338173
added wasm mime type for cvat_ui
425c64b
reverted comment
caa3f6b
removed unused import
azhavoro 4f3d3cb
Az/update data streaming (#1308)
azhavoro 83dbe8f
Task creator validators & help message (#1303)
bsekachev 8a28da7
fixed frame navigation (#1307)
azhavoro 0135908
fixed image drawing for the both UI (#1302)
azhavoro 483835d
added validators for start_frame, stop_frane and chunk_size (#1310)
azhavoro 1b8c2d9
React UI, data streaming: Fixed preview position (#1312)
bsekachev da96b1e
React UI, data streaming: Added displaying filename (#1311)
bsekachev 19ab73d
Disable UI till first frame is ready (#1317)
bsekachev 5f0ad2a
Az/chunk size (#1315)
azhavoro 29e7b86
UI is frozen till the first frame is initialized (#1320)
bsekachev cb268ee
Az/update data streaming (#1324)
azhavoro eac9a1b
Canvas failing and chunk loading status (#1306)
ActiveChooN fe40943
Az/data streaming resolve conflicts (#1325)
azhavoro d787ffe
Az/data streaming resolve conflicts (#1326)
azhavoro 888db4d
Merge remote-tracking branch 'origin/develop' into fix
d6d759d
fixed conflict after merge
d9bbe67
Merge pull request #1327 from opencv/fix
nmanovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
added new models, migrations
- Loading branch information
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,57 @@ | ||
import os | ||
from enum import Enum | ||
import zipfile | ||
|
||
from cvat.apps.engine.media_extractors import ArchiveExtractor, VideoExtractor | ||
from cvat.apps.engine.models import DataChoice | ||
|
||
|
||
class FrameProvider(): | ||
class ChunkType(Enum): | ||
IMAGE = 0 | ||
VIDEO = 1 | ||
|
||
def __init__(self, db_task): | ||
self._db_task = db_task | ||
self._chunk_type = self.ChunkType.VIDEO if db_task.mode == 'interpolation' else self.ChunkType.IMAGE | ||
self._chunk_extractor_class = ArchiveExtractor if self._chunk_type == self.ChunkType.IMAGE else VideoExtractor | ||
def __init__(self, db_data): | ||
self._db_data = db_data | ||
# self._chunk_type = db_data.type | ||
if db_data.type == DataChoice.IMAGESET: | ||
self._chunk_extractor_class = ArchiveExtractor | ||
elif db_data.type == DataChoice.VIDEO: | ||
self._chunk_extractor_class = VideoExtractor | ||
else: | ||
pass # TODO | ||
self._extracted_chunk = None | ||
self._chunk_extractor = None | ||
|
||
def __iter__(self): | ||
for i in range(self._db_task.size): | ||
for i in range(self._db_data.size): | ||
yield self.get_frame(i) | ||
|
||
def __len__(self): | ||
return self._db_task.size | ||
return self._db_data.size | ||
|
||
def get_frame(self, frame_number): | ||
if frame_number < 0 or frame_number >= self._db_task.size: | ||
if frame_number < 0 or frame_number >= self._db_data.size: | ||
raise Exception('Incorrect requested frame number: {}'.format(frame_number)) | ||
chunk_number = frame_number // self._db_task.data_chunk_size | ||
frame_offset = frame_number % self._db_task.data_chunk_size | ||
chunk_number = frame_number // self._db_data.chunk_size | ||
frame_offset = frame_number % self._db_data.chunk_size | ||
chunk_path = self.get_chunk(chunk_number) | ||
if chunk_number != self._extracted_chunk: | ||
self._extracted_chunk = chunk_number | ||
self._chunk_extractor = self._chunk_extractor_class([chunk_path], 95) | ||
|
||
return self._chunk_extractor[frame_offset] | ||
|
||
def get_chunk(self, chunk_number): | ||
return self._db_task.get_chunk_path(chunk_number) | ||
def get_compressed_chunk(self, chunk_number): | ||
path = self._db_data.get_compressed_chunk_path(chunk_number) | ||
if self._db_data.type == DataChoice.LIST: | ||
zip_chunk_path = '{}.list'.format(os.path.splitext(path)[0]) | ||
if not os.path.exists(zip_chunk_path): | ||
with zipfile.ZipFile(zip_chunk_path, 'x') as zip_chunk: | ||
with open(path, 'r') as images: | ||
for im_path, idx in enumerate(images): | ||
zip_chunk.write( | ||
filename=im_path.strip(), | ||
arcname='{:06d}.jpeg'.format(idx), | ||
) | ||
path = zip_chunk_path | ||
|
||
return path | ||
|
||
def get_preview(self): | ||
return os.path.join(self._db_task.get_data_dirname(), 'preview.jpg') | ||
return self._db_data.get_preview_path() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment for future discussion. I generally like the class but prefer to change its interface:
The main idea behind the change is to keep the API stable if we generate compressed frames on the fly with a quality. Thus we will be able to call get_frame(self, n, 75).