Giter VIP home page Giter VIP logo

Comments (4)

dragen1860 avatar dragen1860 commented on May 27, 2024 1

To get multiple frames at once, use get_batch this is the efficient way to obtain a long list of frames. Perhaps with decord.bridge.set_bridge('torch') could be a more efficient data pre-process method.

hi, but my question is not get_batch to obtains several frames meanwhile. My question is: buffer = vr.get_batch(index).asnumpy() the buffer tensor is never used. why use buffer before images_group?

from ask-anything.

yinanhe avatar yinanhe commented on May 27, 2024

To get multiple frames at once, use get_batch this is the efficient way to obtain a long list of frames. Perhaps with decord.bridge.set_bridge('torch') could be a more efficient data pre-process method.

from ask-anything.

yinanhe avatar yinanhe commented on May 27, 2024

Sorry for just realizing that this was a duplicate block that wasn't removed during code cleanup. It has been corrected, and indeed, that data block wasn't utilized.

vr = VideoReader(video_path, ctx=cpu(0))
num_frames = len(vr)
frame_indices = self.get_index(num_frames, num_segments)
#duration = len(vr) // vr.get_avg_fps()
#index = np.linspace(0, len(vr)-1, num=int(duration))
# transform
input_mean = [0.48145466, 0.4578275, 0.40821073]
input_std = [0.26862954, 0.26130258, 0.27577711]
transform = T.Compose([
GroupScale(int(224), interpolation=InterpolationMode.BICUBIC),
GroupCenterCrop(224),
Stack(),
ToTorchFormatTensor(),
GroupNormalize(input_mean, input_std)
])
images_group = list()
for frame_index in frame_indices:
img = Image.fromarray(vr[frame_index].asnumpy())
images_group.append(img)
torch_imgs_224 = transform(images_group)

from ask-anything.

dragen1860 avatar dragen1860 commented on May 27, 2024

thanks for your responsible work.

from ask-anything.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.