ee602b6f68f0bdd19f449a86955697f8f0a2d54c,gluoncv/data/transforms/video.py,VideoMultiScaleCrop,forward,#VideoMultiScaleCrop#Any#,199

Before Change


        return crop_sizes

    def forward(self, clips):
        clips = clips.asnumpy()
        h, w, c = clips.shape

        crop_size_pairs = self.fillCropSize(h, w)
        size_sel = random.randint(0, len(crop_size_pairs)-1)
        crop_height = crop_size_pairs[size_sel][0]
        crop_width = crop_size_pairs[size_sel][1]

        if self.fix_crop:
            offsets = self.fillFixOffset(h, w)
            off_sel = random.randint(0, len(offsets)-1)
            h_off = offsets[off_sel][0]
            w_off = offsets[off_sel][1]
        else:
            h_off = random.randint(0, h - self.height)
            w_off = random.randint(0, w - self.width)

        scaled_clips = np.zeros((self.height, self.width, c))
        num_imgs = int(c / 3)
        for frame_id in range(num_imgs):
            cur_img = clips[:, :, frame_id*3:frame_id*3+3]
            crop_img = cur_img[h_off:h_off+crop_height, w_off:w_off+crop_width, :]
            scaled_clips[:, :, frame_id*3:frame_id*3+3] = \
            	self.cv2.resize(crop_img, (self.width, self.height))
        return nd.array(scaled_clips)

class VideoCenterCrop(Block):
    Crops the given numpy array at the center to have a region of

After Change


            h_off = random.randint(0, h - self.height)
            w_off = random.randint(0, w - self.width)

        new_clips = []
        for cur_img in clips:
            crop_img = cur_img[h_off:h_off+crop_height, w_off:w_off+crop_width, :]
            new_clips.append(self.cv2.resize(crop_img, (self.width, self.height)))
        return new_clips


class VideoCenterCrop(Block):
    Crop images at the center to have a region of
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: dmlc/gluon-cv
Commit Name: ee602b6f68f0bdd19f449a86955697f8f0a2d54c
Time: 2019-09-21
Author: yizhu59@gmail.com
File Name: gluoncv/data/transforms/video.py
Class Name: VideoMultiScaleCrop
Method Name: forward


Project Name: lene/nn-wtf
Commit Name: 8302f871c1b6de4abec3b06ee11f785d4d7f5c1b
Time: 2016-03-05
Author: lene.preuss@gmail.com
File Name: nn_wtf/trainer.py
Class Name: Trainer
Method Name: do_eval


Project Name: keras-team/autokeras
Commit Name: 49ca8c83ca65a1060713d0295d1d206b43933e3b
Time: 2017-12-18
Author: jhfjhfj1@gmail.com
File Name: autokeras/generator.py
Class Name: HillClimbingClassifierGenerator
Method Name: generate