Closed agentmorris closed 1 year ago
I think it is possible, but I haven't met anyone who did that. We make the checkpoint for MegaDetector with all the model weights available - see https://github.com/microsoft/CameraTraps/blob/master/megadetector.md#download-links. The configuration file that the model was trained with is also linked there. From those pieces (and consulting TF OD API, which implements the model) you could potentially figure out which weights to load for which tensors, although I suspect one difficulty is identifying the tensors by their name in the checkpoint.
(Comment originally posted by yangsiyu007)
You can load the model file (.pb file) in TensorFlow and write your own code to feed data into it and run the model on your data. Keras won't be of much use since it does not support the TF object detection API, so you would be mostly replicating code in the run_tf_detector.py file (model loading is done in lines 144-153 and 198-296). If you use TF 2.x you will have to use tf.compat.v1.Session() instead of tf.Session() but with that everything works. I have successfully run MD in R using the tensorflow package (code coming once it's cleaned up).
(Comment originally posted by matobler)
Hi,
Could it be possible to use the estimated models (I mean, the model weights) outside of MegaDetector, for those of us who have their own codes already running? I would like to reuse your estimated models in my codes implemented in Keras. Do you think it could be possible?
I think this could be very interesting for many people...
Issue cloned from Microsoft/CameraTraps, original issue posted by vmielecnrs on Sep 21, 2020.