Skip to content

Conversation

@TobyWanKenobi
Copy link
Contributor

Added a method "loadFromString", which is based on the "load" one, to the StatModel class. It
allow to directly pass a String of a saved model which can be usefull and faster when you have a huge trained file in a variable.

Added a method "loadFromString" which is based on the "load" one. It
allow to directly pass the XML string which can be usefull and faster
when you have a huge file in a variable.
Edited previous code to change tabs into spaces.
Attempting to re-editing the documentation, to satisfy buildbot error
status.
Re-edited the documentation again.
@vpisarev vpisarev self-assigned this Dec 6, 2014
@vpisarev
Copy link
Contributor

vpisarev commented Dec 6, 2014

@TobyWanKenobi, thank you! This may be useful indeed. One request though; please, remove FileStorage::FORMAT_XML, because our file storage reader can detect format automatically; sometimes people prefer YAML, and we are also thinking of adding JSON support. In other words, XML-only restriction is unnecessary and it does not simplify anything.

Removed the "FileStorage::FORMAT_XML" to generalize format of the String
model.
@vpisarev
Copy link
Contributor

👍

@opencv-pushbot opencv-pushbot merged commit b35f5d1 into opencv:master Dec 15, 2014
vpisarev added a commit that referenced this pull request Dec 15, 2014
mkostin pushed a commit to microsoft/opencv that referenced this pull request Dec 26, 2014
@edgarriba
Copy link
Contributor

@vpisarev Is this JSON support still in mind? I may need it to import some structure from motion file formats in opencv/opencv_contrib#509

@cbalint13
Copy link
Contributor

@edgarriba , @vpisarev ,

Well, I would be interested to see JSON too as I/O backend. I always like alternatives and variety within the API offer.

--------<<<------

But,

  • With respect, I know there are JSON supporters out there, but would express my solely opinion that JSON not suites up for descriptors (quite large matrices), and not even for large amount 3D points or match indices. That must be a joke involving JSON for such task. Better than that in the spirit of JSON / XML style would be google-protobuf (that has binary format & "zero-copy" casts / things ). On top the very JSON's would be an inefficient storage when the size matters and I am not even mention the serialization / deserialization overhaul of JSON.
  • However, I must agree that for smaller tasks JSON is very nice, expressive and highly intuitive even reading it as .txt file. To have as storage backend in realistic way would be to store no more than to simple matrices like lets say in opencv's world: VecX, MatX, PointX etc.
  • I pledged same things some years ago at OpenMVG authors when they decided to use JSON. And at that time I pledged for HDF5 or maybe plain binaries. The reply of majority at that time was that HDF5 is too sophisticated and have hard API which yes is true. But as of 2016 I believe we managed to prove the contrary with the new OpenCV's HDF api that can be used in very simple and efficient ways even on largest scale. Since last year OpenMVG started to add binary support too in sort of raw thing (hope i am correct here).

To example on the large scale: see https://github.com/cbalint13/opencv-dlco for how simple is to read / write / even with smart sub-windowed mode over large >8Gb HDF matrices & tensors, even with internal compressions. Such project woudn't be possible efficiently without OpenCV hdf5 module, would require spending more than half of devel time to invent some raw binaries or something to suite up with that large I/O.

Ditto for outside world various neuralnets implemetation that uses tensors & matrices in tandem with HDF5 right from beginning of their development.

  • Once again, i stated an opinion here, no ofense. And yes JSON would have its good place in the API.

@edgarriba
Copy link
Contributor

I agree with your opinion but as you mentioned and AFAIK, some sfm frameworks like OpenMVG and OpenSfM have their long term support in JSON format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants