alianse777 / darknet-rust

A Rust wrapper for Darknet, an open source neural network framework written in C and CUDA.
http://pjreddie.com/darknet/
MIT License
33 stars 8 forks source link

Enable darknet image to image::ImageBuffer conversion #4

Closed jerry73204 closed 4 years ago

jerry73204 commented 4 years ago

I see you left a comment that the impl TryFrom<Image> for ImageBuffer<> does not compile on rustc 1.40. Since 1.43.0, the rule is relaxed that it can succussfully compile on stable Rust. I think it's time to merge this feature to master.

If possible, I suggest updating your rust to newer stable version by rustup update. If you have whatever reason to stick to 1.40, we could use conditional compilation trick (adding features).

jerry73204 commented 4 years ago

I see the revert change at the tiny_yolov3 example here. I think we can keep both to_image_buffer<P>() and impl TryFrom<Image> for ImageBuffer<>. The former wins in readability, the latter is more rusty and is useful for generic programming (For example, write a method to accept any type that can be converted to ImageBuffer). I would suggest using TryFrom internally in to_image_buffer() to avoid code duplication.

alianse777 commented 4 years ago

As for rustc version, I just think that it is good idea to keep some compatibility margin. Will bump to 1.43 now.