mirror of
https://github.com/open-mmlab/mmocr.git
synced 2025-06-03 21:54:47 +08:00
Remove outdated resources in demo/ (#1747)
* Remove outdated resources in demo/ * update
This commit is contained in:
parent
62d440fe8e
commit
3aa9572a64
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 154 KiB |
Binary file not shown.
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
@ -1,48 +0,0 @@
|
|||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
import cv2
|
|
||||||
import torch
|
|
||||||
|
|
||||||
from mmocr.apis import init_detector, model_inference
|
|
||||||
from mmocr.registry import DATASETS # noqa: F401
|
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
|
||||||
parser = argparse.ArgumentParser(description='MMDetection webcam demo.')
|
|
||||||
parser.add_argument('config', help='Test config file path.')
|
|
||||||
parser.add_argument('checkpoint', help='Checkpoint file.')
|
|
||||||
parser.add_argument(
|
|
||||||
'--device', type=str, default='cuda:0', help='CPU/CUDA device option.')
|
|
||||||
parser.add_argument(
|
|
||||||
'--camera-id', type=int, default=0, help='Camera device id.')
|
|
||||||
parser.add_argument(
|
|
||||||
'--score-thr', type=float, default=0.5, help='Bbox score threshold.')
|
|
||||||
args = parser.parse_args()
|
|
||||||
return args
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
args = parse_args()
|
|
||||||
|
|
||||||
device = torch.device(args.device)
|
|
||||||
|
|
||||||
model = init_detector(args.config, args.checkpoint, device=device)
|
|
||||||
|
|
||||||
camera = cv2.VideoCapture(args.camera_id)
|
|
||||||
|
|
||||||
print('Press "Esc", "q" or "Q" to exit.')
|
|
||||||
while True:
|
|
||||||
ret_val, img = camera.read()
|
|
||||||
result = model_inference(model, img)
|
|
||||||
|
|
||||||
ch = cv2.waitKey(1)
|
|
||||||
if ch == 27 or ch == ord('q') or ch == ord('Q'):
|
|
||||||
break
|
|
||||||
|
|
||||||
model.show_result(
|
|
||||||
img, result, score_thr=args.score_thr, wait_time=1, show=True)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
Loading…
x
Reference in New Issue
Block a user