@@ -5,81 +5,25 @@ Pytorch based data streamer. (Capture, Video & Image).
5
5
## Install
6
6
7
7
```
8
- pip install git+https://github.com/liruilong940607 /streamer_pytorch --upgrade
8
+ pip install git+https://github.com/Project-Splinter /streamer_pytorch --upgrade
9
9
```
10
10
11
11
## Usage
12
12
13
13
```
14
14
# images
15
15
python demo.py --images <IMAGE_PATH> <IMAGE_PATH> <IMAGE_PATH> --loop --vis
16
+ # image folder
17
+ python demo.py --image_folder <IMAGE_FOLDER_PATH> --loop --vis
16
18
# videos
17
19
python demo.py --videos <VIDEO_PATH> <VIDEO_PATH> <VIDEO_PATH> --vis
18
20
# capture device
19
21
python demo.py --camera --vis
20
22
```
21
23
22
- see also in ` demo.py `
23
- ```
24
- import tqdm
25
- import argparse
26
- import torch
27
- import numpy as np
28
- import cv2
29
- import streamer_pytorch as streamer
30
-
31
- parser = argparse.ArgumentParser(description='.')
32
- parser.add_argument(
33
- '--camera', action="store_true")
34
- parser.add_argument(
35
- '--images', default="", nargs="*")
36
- parser.add_argument(
37
- '--videos', default="", nargs="*")
38
- parser.add_argument(
39
- '--loop', action="store_true")
40
- parser.add_argument(
41
- '--vis', action="store_true")
42
- args = parser.parse_args()
43
-
44
- def visulization(data):
45
- window = data[0].numpy()
46
- window = window.transpose(1, 2, 0)
47
- window = (window * 0.5 + 0.5) * 255.0
48
- window = np.uint8(window)
49
- window = cv2.cvtColor(window, cv2.COLOR_BGR2RGB)
50
- window = cv2.resize(window, (0, 0), fx=2, fy=2)
51
-
52
- cv2.imshow('window', window)
53
- cv2.waitKey(1)
54
-
55
- if args.camera:
56
- data_stream = streamer.CaptureStreamer()
57
- elif len(args.videos) > 0:
58
- data_stream = streamer.VideoListStreamer(
59
- args.videos * (100 if args.loop else 1))
60
- elif len(args.images) > 0:
61
- data_stream = streamer.ImageListStreamer(
62
- args.images * (100 if args.loop else 1))
63
-
64
- loader = torch.utils.data.DataLoader(
65
- data_stream,
66
- batch_size=1,
67
- num_workers=1,
68
- pin_memory=False,
69
- )
70
-
71
- try:
72
- for data in tqdm.tqdm(loader):
73
- if args.vis:
74
- visulization(data)
75
- except Exception as e:
76
- print (e)
77
- del data_stream
78
-
79
- ```
80
-
81
24
## API
82
25
83
26
- CaptureStreamer(id=0, width=512, height=512, pad=True)
84
27
- VideoListStreamer(files, width=512, height=512, pad=True)
85
28
- ImageListStreamer(files, width=512, height=512, pad=True)
29
+ - aug_matrix(w1, h1, w2, h2, pad=True)
0 commit comments