Comments (3)
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.
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.
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:
- Move
cam_id
fromFrameContainer
toFrame
in the Schema, making it possible to store frames from different cameras in oneFrameContainer
. - yield the
FrameContainer
object as dictionary (without frames) as second return value along with theFrame
object - Convert the
Frame
to a python dictionary and add the missing information from theFrameContainer
.
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)
- Capnp Schema Review HOT 6
- Parameters start and end HOT 2
- Fix C++ converter tool
- New timestamp format for 2016
- Move gt_to_hdf5 script to another repo HOT 1
- New function to convert the decodedId array to integer
- Possible confusing use of Repository Class
- Interval problem with Repository.iter_fnames() HOT 1
- Use Python Version with Windows HOT 1
- Shorten the return value of __repr__ in a FrameContainer HOT 1
- repo.iter_frames throws error HOT 3
- Improve quality of comments inside the capnp schema
- capnp schema needs better hive coordinates support HOT 1
- capnp schema needs version control coupled with tags on this repo
- iter_frames not returning frames in sorted order when cam is None
- iter_frames returns nothing if time period between start and end is too small (?) HOT 1
- Iter_frames raises AssertionError if begin and end are outside of Repository limits
- iter_frames raises AssertionError, when 00,20,40 folders are missing.
- x and y coordinates are swapped HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bb_binary.