Giter VIP home page Giter VIP logo

Comments (3)

berleon avatar berleon commented on June 25, 2024 1

I would prefer option 2 with the FrameContainer as second return value.

I would prefer that too. That way the caller can always get the values he is interested in.

I also like you suggested enhancement, but you have to decide how useful it would be for the tracking.

You already had some basic code for iter_frames, right? Do you want to implement it?

from bb_binary.

berleon avatar berleon commented on June 25, 2024

Would the function simple yield raw Cap'N Proto frames? Or would they also be converted to
numpy arrays? What if you are interested in the cam_id which is stored only in the FrameContainer at the top level? Would this use-case be out of scope of the iter_frames function?
I personally prefer start till end like the python range function.

from bb_binary.

b2m avatar b2m commented on June 25, 2024

I personally prefer start till end like the python range function.

Agreed

Regarding the cam_id: I do not like the idea of dropping the information for a convenience method like iter_frames. So here are three suggestions:

  1. Move cam_id from FrameContainer to Frame in the Schema, making it possible to store frames from different cameras in one FrameContainer.
  2. yield the FrameContainer object as dictionary (without frames) as second return value along with the Frame object
  3. Convert the Frame to a python dictionary and add the missing information from the FrameContainer.

Otherwise it could be argued, that if you need the cam_id or other information from FrameContainer, use iter_fnames or make several passes with the cam parameter of iter_frames.

I would prefer option 2 with the FrameContainer as second return value.
The calling code then would look something like:

from numpy.lib.recfunctions import append_fields
for frame, fc in repo.iter_frames(start, end):
    arr = convert_frame_to_numpy(frame)
    cam_col = np.repeat(fc.camId, arr.shape[0])
    arr_ext = append_fields(arr, 'cam_id', cam_col, usemask=False)
    # ... do something with arr_ext like stacking

We also could enhance convert_frame_to_numpy() to automatically add and fill columns like:

for frame, fc in repo.iter_frames(start, end):
    arr = convert_frame_to_numpy(frame, add_columns={'cam_id': fc.camId})

From my perspective this would be the most practical solution.

from bb_binary.

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.