Git Product home page Git Product logo

keplerlab / katna Goto Github PK

View Code? Open in Web Editor NEW
291.0 26.0 56.0 43.35 MB

Tool for automating common video key-frame extraction, video compression and Image Auto-crop/Image-resize tasks

Home Page: https://katna.readthedocs.io/

License: MIT License

Python 99.99% Shell 0.01%
frame-extraction video vision-framework artificial-intelligence python crops image-cropping image-processing video-compression image-resizing

katna's Issues

Timing of keyframe extraction

Haven't tried yet, but am wondering what is the best mechanism for doing less work for a given video to speed up?

Can we just skip N frames in the range here?

for _ in range(0, self.max_frames_in_chunk):

I'm aiming to find the places of the algorithm that takes the longest time and try to minimize it,
Can a possible way to do so will be to consider a video as a collection of 1 frame for every 1 sec and then doing the same pipeline?

How long it takes to get 5-10 frames from a 1,5,10,15,20,25,30 min videos? with how many cores?

Thanks

It takes a long time to extract video keyframes..

I use the basic extract_video_keyframes function in Colab. Sometimes it works but most of the time it takes a pretty long time to extract keyframes. I only want to extract the single one frame from a 15s video. Has anybody also face this problem? Or is there anything wrong with my environment settting?

image

multi-processing issue while running on Google Colab


ValueError Traceback (most recent call last)
in ()
4
5 #instantiate the video class
----> 6 vd = Video()
7
8 #number of key-frame images to be extracted

2 frames
/usr/lib/python3.6/multiprocessing/pool.py in init(self, processes, initializer, initargs, maxtasksperchild, context)
165 processes = os.cpu_count() or 1
166 if processes < 1:
--> 167 raise ValueError("Number of processes must be at least 1")
168
169 if initializer is not None and not callable(initializer):

ValueError: Number of processes must be at least 1

Why do I have to set no_of_frames?

  1. Why do I have to set no_of_frames?
  2. What is the maximum value of no_of_frames?
  3. Can the algorithm automatically find out images that are different from other frames as keyframes without setting no_of_frames?
  4. If I set no_of_frames to a very large number, does it mean that every frame will be extracted?
    Thank you for your reply!

Image Sorting

Can you please help me for sorting the extracted images from video. The extracted Images are not in sequence as per video playback.

how to make it run in multiprocess

as the doc has say, video must create in main.
i have a project, which need to use video extract function, but there are other processes.
how can i pass video object to other processes since it's contain pool.
thanks for answering.

About extract_video_keyframes only return 4 frames

when I call the extract_video_keyframes method
No matter what The parameter 'no_of_frames' set to,
only 4 frames of images will be returned

this is my code

from Katna.video import Video
from Katna.writer import KeyFrameDiskWriter

vd = Video()

diskwriter = KeyFrameDiskWriter(location="selectedframes")

video_file_path = 'D:/video/color.avi'
no_of_frames_to_returned = 40

frame = vd.extract_video_keyframes(
     no_of_frames=no_of_frames_to_returned, file_path=video_file_path,
     writer=diskwriter
)

my video have 171 frames and no_of_frames is equal to 40, but only return four frames.

please help me ,please

How to output specified image size only?

Using the example "crop all images in a single directory", if I use:

# crop dimensions
crop_width = 512
crop_height = 512

Then I'll also get images that are 460x460, as well as 512x512. Is there a way to force the specified dimensions only?

Conversion failed

We Call the extract_video_keyframes method to extract the keyframes of the following video , but the following problem occurs:
46171619244244_ pic_hd

error_video.mp4

image co ordinates

i want to know how i can extract the corinates of the smart cropped image in respect to the original image like
crop{
x:
y:
weigth:
height:}

Create AUR Package

Hello,
it would be have AUR package so user will be able to install katna throw package manager.

sorting of the output key frame images

The sorting of the output key frame images is random, not the order of video frames. It is highly recommended that the name of the output image is the frame ID.

train?

is it can be trained in my dataset?

memory problem

Hi, congratulations o your work! :-)
So, I'm trying to use katna on a windows 10 machine with 16gb ram, python 3.8 and katna 0.9.0.
I am testing using a 2,6gb video and my memory keeps reaching 100% and the script eventually crashes. I also tried setting the Katna.config.FrameExtractor.max_frames_in_chunk from 2500 to 100 and Katna.Video.n_processes to 1, but still got the same problem. Any idea of how to solve this?

This is a snippet of the code I'm running:

if __name__ == "__main__":

  # initialize video module
  vd = Video()
  print('vd.n_processes:')
  print(vd.n_processes)

  # number of images to be returned
  no_of_frames_to_returned = 12
  diskwriter = KeyFrameDiskWriter(location=out_path)

  # extract keyframes and process data with diskwriter
  vd.extract_video_keyframes(
       no_of_frames=no_of_frames_to_returned, file_path=video_file_path,
       writer=diskwriter
  )```

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.