1- from scannerpy import Client , DeviceType
2- from scannerpy . storage import NamedVideoStream , PythonStream
1+ from scannertools . storage . python import PythonStream
2+ import scannerpy as sp
33import os
44import sys
55import math
@@ -21,10 +21,10 @@ def main():
2121 print ('Detecting objects in movie {}' .format (movie_path ))
2222 movie_name = os .path .splitext (os .path .basename (movie_path ))[0 ]
2323
24- sc = Client ()
24+ sc = sp . Client ()
2525
2626 stride = 1
27- input_stream = NamedVideoStream (sc , movie_name , path = movie_path )
27+ input_stream = sp . NamedVideoStream (sc , movie_name , path = movie_path )
2828 frame = sc .io .Input ([input_stream ])
2929 strided_frame = sc .streams .Stride (frame , [stride ])
3030
@@ -33,12 +33,14 @@ def main():
3333 objdet_frame = sc .ops .ObjDetect (
3434 frame = strided_frame ,
3535 dnn_url = model_url ,
36- device = DeviceType .GPU if sc .has_gpu () else DeviceType .CPU ,
36+ device = sp . DeviceType .GPU if sc .has_gpu () else sp . DeviceType .CPU ,
3737 batch = 2 )
3838
39- detect_stream = NamedVideoStream (sc , movie_name + '_detect' )
39+ detect_stream = sp . NamedVideoStream (sc , movie_name + '_detect' )
4040 output_op = sc .io .Output (objdet_frame , [detect_stream ])
41- sc .run (output_op )
41+ sc .run (output_op ,
42+ sp .PerfParams .estimate (),
43+ cache_mode = sp .CacheMode .Overwrite )
4244
4345 print ('Extracting data from Scanner output...' )
4446 # bundled_data_list is a list of bundled_data
@@ -58,9 +60,11 @@ def main():
5860 drawn_frame = sc .ops .TFDrawBoxes (frame = strided_frame ,
5961 bundled_data = bundled_data ,
6062 min_score_thresh = 0.5 )
61- drawn_stream = NamedVideoStream (sc , movie_name + '_drawn_frames' )
63+ drawn_stream = sp . NamedVideoStream (sc , movie_name + '_drawn_frames' )
6264 output_op = sc .io .Output (drawn_frame , [drawn_stream ])
63- sc .run (output_op )
65+ sc .run (output_op ,
66+ sp .PerfParams .estimate (),
67+ cache_mode = sp .CacheMode .Overwrite )
6468
6569 drawn_stream .save_mp4 (movie_name + '_obj_detect' )
6670
@@ -73,5 +77,3 @@ def main():
7377
7478if __name__ == '__main__' :
7579 main ()
76-
77-
0 commit comments