Caffe was a pioneer in deep learning, and it’s closed now. Don’t develop on it, but you can find some old models in this format you can use with opencv dnn.
Keras project was absorbed by TensorFlow 2 as a high level API.
Torch is closed. PyTorch, once the Python API for Torch, continues on its own. don’t know its status and future.
Tensorflow 2 seems to be the most advanced framework, you can find the some of the most recent models only in this format. If you need to start with deep learning, i believe today this is the framework for you. About it, pros and cons:
- It incorpores Keras as an entry level, a high level API, so it is easy to start with
- After Keras you can dig down through “pure” TensorFlow 2 API
- Web support with TensorFlow.JS, running TensorFlow 2 models
- It is incompatible with TensorFlow 1 (you must migrate models from 1 to 2)
- OpenCV dnn doesn’t support model files in tensorflow 2 format (you must save them as onnx to port to opencv; if you get an already trained model it can be hard, even impossible, because of new layers on TensorFlow 2)
- TensorFlow 2 API is evolving fast and there are many incompatibilities between different 2.x versions, and sometimes they are so silly keeping you wondering “Why?!”
Adding TensorFlow 2 compatibility to OpenCV dnn is hard, and it seems no one is working on it right now.
So, if you are going to build and train networks in TensorFlow 2, you can save them as onnx in order to make it work with opencv dnn. It won’t be easy if you use some advanced new layers from TensorFlow 2.
So, my preferences in 2021 are:
- To start with dnn: Keras on TensorFlow 2
- For advanced projects: TensorFlow 2
- For use in OpenCV and other frameworks: TensorFlow 2, saved as onnx
- When not possible to port TensorFlow 2 to onnx: use TensorFlow Lite as a runtime framework
I’m not really a fan of TensorFlow 2. If you are a PyTorch fan, please be nice, I didn’t mean to offend you