Пример #1
0
 def test_exp_images_2_video(self):
     tracker = IoUTracker()
     tracker.load_frames(root_images=_root_mirror_images,
                         frame_num_start=-1,
                         frame_num_end=-1)
     hooks = [
         Recorder(),
         VideoWriterForTracking(root_output_video=_root_mirror_output_video,
                                do_resize=True,
                                fps=30.0,
                                size=(3840, 2160)),
     ]
     tracker.register_hooks(hooks)
     tracker.track()
Пример #2
0
    def test_road_object_tracking_transdiff(self):
        tracker = IoUTracker()
        tracker.load_frames(root_images=_root_road_object_images,
                            frame_num_start=-1,
                            frame_num_end=-1)
        hooks = [
            RoadObjectDetection(score_thre=0.17),
            BoxCoordinateNormalizer(),
            ApproachingInitializer(),
            FeatureMatcher(interval=6, box_remove_margin=0.1),
            # TransformedMidpointCalculator(),
            TransformedMidpointDifferencer(),
            # HorizontalMovementCounter(right_trend_is_approaching=False),
            # AreaCalculator(),
            # MidpointCalculator(),
            # WidthAndHeihtCalculator(),
            RiskyJudger(),
            Recorder(),
            ImageWriter(root_output_images=_root_road_object_output_images),
            ImageWriterForApproaching(
                root_output_images=_root_road_object_output_approaching_images
            ),
            VideoWriterForTracking(
                root_output_video=_root_road_object_output_video,
                do_resize=True,
                fps=30.0),
            VideoWriterForApproaching(
                root_output_video=_root_road_object_output_approaching_video,
                do_resize=True,
                fps=30.0),
            VideoWriterForMatching(
                root_output_video=
                _root_road_object_output_feature_matching_video,
                size=(1024, 512),
                do_resize=True,
                fps=30.0),
            MOTWriter(root_output_mot=_root_road_object_output_mot,
                      labels=["vehicle"]),
            MOTWriterForApproaching(
                root_output_mot=_root_road_object_output_approaching_mot),
            MOTWriterForRisky(
                root_output_mot=_root_road_object_output_risky_mot),
            FeatureStatWriter(root_output_feature_stat=_root_feature_stat),
        ]

        tracker.register_hooks(hooks)
        tracker.track()
Пример #3
0
 def test_mirror_tracking(self):
     tracker = IoUTracker()
     tracker.load_frames(root_images=_root_mirror_images,
                         frame_num_start=-1,
                         frame_num_end=-1)
     hooks = [
         MirrorDetection(0.3, 0.3),
         Recorder(),
         ImageWriter(root_output_images=_root_mirror_output_images),
         VideoWriterForTracking(root_output_video=_root_mirror_output_video,
                                do_resize=True,
                                fps=30.0,
                                size=(3840, 2160)),
         MOTWriter(root_output_mot=_root_mirror_output_mot)
     ]
     tracker.register_hooks(hooks)
     tracker.track()
Пример #4
0
                                                   'frames_for_tracking'),
            root_mirror_output_video=os.path.join(path_exp, seq_name,
                                                  'mir_tracking_result',
                                                  'video_for_tracking'),
            root_mirror_output_mot=os.path.join(path_exp, seq_name,
                                                'mir_tracking_result',
                                                'mot_for_tracking'),
            root_mirror_seqs=os.path.join(path_exp, seq_name, 'mirror_seqs'))

        for root_name, root in roots_for_input.items():
            assert os.path.isdir(root), f'Not exists: {root} for {seq_name}'

        for root_name, root in roots_for_output.items():
            os.makedirs(root, exist_ok=True)

        tracker = IoUTracker()
        tracker.load_frames(root_images=roots_for_input['root_mirror_images'],
                            frame_num_start=-1,
                            frame_num_end=-1)
        hooks = [
            MirrorDetection(0.3, 0.3),
            Recorder(),
            ImageWriter(root_output_images=roots_for_output[
                'root_mirror_output_images']),
            VideoWriterForTracking(
                root_output_video=roots_for_output['root_mirror_output_video'],
                do_resize=True,
                fps=30.0,
                size=(3840, 2160)),
            MOTWriter(
                root_output_mot=roots_for_output['root_mirror_output_mot'])
Пример #5
0
                root_road_object_output_approaching_mot=os.path.join(
                    path_ro_exp, seq_name, mir_seq_name,
                    'mot_for_approaching'),
                root_road_object_output_feature_matching_video=os.path.join(
                    path_ro_exp, seq_name, mir_seq_name,
                    'video_for_feature_matching'),
                root_road_object_output_risky_mot=os.path.join(
                    path_ro_exp, seq_name, mir_seq_name, 'mot_for_risky'),
                root_road_object_feature_stat=os.path.join(
                    path_ro_exp, seq_name, mir_seq_name, 'feature_stat'),
            )

            for root_name, root in roots_for_output.items():
                os.makedirs(root, exist_ok=True)

            tracker = IoUTracker()
            tracker.load_frames(root_images=root_cropped_images,
                                frame_num_start=-1,
                                frame_num_end=-1)
            hooks = [
                RoadObjectDetection(score_thre=0.17),
                BoxCoordinateNormalizer(),
                ApproachingInitializer(),
                FeatureMatcher(interval=6, box_remove_margin=0.1),
                # TransformedMidpointCalculator(),
                TransformedMidpointDifferencer(),
                # HorizontalMovementCounter(right_trend_is_approaching=False),
                # AreaCalculator(),
                # MidpointCalculator(),
                # WidthAndHeihtCalculator(),
                RiskyJudger(),
Пример #6
0
from pipedet.structure.large_image import LargeImage
from pipedet.solver.get_mirror_seq import MirrorSeq
"""
Mirror tracking demonstration.
"""

_root_in_vehicle_frames = '/home/appuser/src/pipedet/simple_demonstration/demo_in_vehicle_frame'

_root_output_video_for_tracking = '/home/appuser/src/pipedet/simple_demonstration/output_mirror_tracking/video_for_tracking'

_root_output_images_for_tracking = '/home/appuser/src/pipedet/simple_demonstration/output_mirror_tracking/images_for_tracking'

_root_output_mot_for_tracking = '/home/appuser/src/pipedet/simple_demonstration/output_mirror_tracking/mot_for_tracking'

if __name__ == '__main__':
    tracker = IoUTracker()
    tracker.load_frames(root_images=_root_in_vehicle_frames,
                        frame_num_start=-1,
                        frame_num_end=-1)
    hooks = [
        MirrorDetection(0.3, 0.3),
        Recorder(),
        ImageWriter(root_output_images=_root_output_images_for_tracking),
        VideoWriterForTracking(
            root_output_video=_root_output_video_for_tracking,
            do_resize=True,
            fps=30.0,
            size=(3840, 2160)),
        MOTWriter(root_output_mot=_root_output_mot_for_tracking)
    ]
    tracker.register_hooks(hooks)