I was wondering if you have reproduced the preprocessing of the data. I tried to reproduce the preprocessing following the instruction in the official one. But I have no idea why the results could not match with the provided .npy. Here is my code:
import numpy as np
from PIL import Image, ImageSequence
size = 256,256
new_width = 224
new_height = 224
img = Image.open('./data/v_CricketShot_g04_c01_rgb.gif');
def my_resize(img):
for frame in ImageSequence.Iterator(img):
copy_frame = frame.copy()
copy_frame = copy_frame.convert("RGB")
resized_frame = copy_frame.resize(size, Image.BILINEAR)
r, g, b = resized_frame.split()
r = np.array(r)
rescaled_r = np.interp(r, (r.min(), r.max()), (-1, +1))
g = np.array(g)
rescaled_g = np.interp(g, (g.min(), g.max()), (-1, +1))
b = np.array(b)
rescaled_b = np.interp(b, (b.min(), b.max()), (-1, +1))
rescaled_array = np.zeros((size[0], size[1], 3))
rescaled_array[..., 0] = rescaled_r
rescaled_array[..., 1] = rescaled_g
rescaled_array[..., 2] = rescaled_b
width, height, color = rescaled_array.shape
left = (width - new_width)/2
right = (width + new_width)/2
top = (height - new_height)/2
bottom = (height + new_height)/2
croped_frame = rescaled_array[left:right, top:bottom, :]
yield croped_frame
copy_frame = my_resize(img)
frames = np.array([np.array(frame) for frame in copy_frame])
Hi,
I was wondering if you have reproduced the preprocessing of the data. I tried to reproduce the preprocessing following the instruction in the official one. But I have no idea why the results could not match with the provided .npy. Here is my code:
Do you have any idea about this?