Skip to content

Commit ad5bfc2

Browse files
committed
release code and demo of YORO
1 parent 8be2e4c commit ad5bfc2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4901705
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
##################################################################################################
3+
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
4+
# Filename : __init__.py
5+
# Abstract :
6+
7+
# Current Version: 1.0.0
8+
# Date : 2020-05-31
9+
##################################################################################################
10+
"""
11+
from .datasets import *
12+
from .models import *
13+
from .apis import *
14+
from .tools import *
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
##################################################################################################
3+
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
4+
# Filename : __init__.py
5+
# Abstract :
6+
7+
# Current Version: 1.0.0
8+
# Date : 2021-05-20
9+
##################################################################################################
10+
"""
11+
from .test import single_gpu_test
12+
__all__ = [
13+
'single_gpu_test'
14+
]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"""
2+
##################################################################################################
3+
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
4+
# Filename : test.py
5+
# Abstract : The common testing api for video text recognition, track, quality score
6+
7+
# Current Version: 1.0.0
8+
# Date : 2021-06-02
9+
##################################################################################################
10+
"""
11+
import numpy as np
12+
13+
import mmcv
14+
import torch
15+
16+
17+
def single_gpu_test(model,
18+
data_loader):
19+
""" Test model with single GPU, used for visualization.
20+
21+
Args:
22+
model (nn.Module): Model to be tested.
23+
data_loader (nn.Dataloader): Pytorch data loader.
24+
25+
Returns:
26+
dict: test results
27+
"""
28+
29+
model.eval()
30+
results = dict()
31+
results['texts'] = []
32+
results['img_info'] = []
33+
results['glimpses'] = []
34+
results['scores'] = []
35+
dataset = data_loader.dataset
36+
prog_bar = mmcv.ProgressBar(len(dataset))
37+
for i, data in enumerate(data_loader):
38+
with torch.no_grad():
39+
result = model(return_loss=False, rescale=True, **data)
40+
texts = result['text']
41+
glimpses = result['glimpses']
42+
glimpses = glimpses.cpu().numpy()
43+
img_infos = result['img_info']
44+
scores = result['scores']
45+
scores = scores.cpu().numpy()
46+
scores = scores.reshape(-1)
47+
batch_size = len(texts)
48+
results['texts'].extend(texts)
49+
results['img_info'].extend(img_infos)
50+
results['glimpses'].extend(glimpses)
51+
results['scores'].extend(scores)
52+
for _ in range(batch_size):
53+
prog_bar.update()
54+
new_glimpse = np.stack(results['glimpses'])
55+
results['glimpses'] = new_glimpse
56+
return results
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
##################################################################################################
3+
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
4+
# Filename : __init__.py
5+
# Abstract :
6+
7+
# Current Version: 1.0.0
8+
# Date : 2021-05-20
9+
##################################################################################################
10+
"""
11+
from .pipelines import *
12+
from .samplers import *
13+
from .multi_frame_dataset import MultiFrameDataset
14+
from .yoro_rcg_dataset import YORORCGDataset
15+
16+
__all__ = ['MultiFrameDataset', 'MetricSampler', 'YORORCGDataset']

0 commit comments

Comments
 (0)