see-- / keras-centernet

A Keras implementation of CenterNet with pre-trained model (unofficial)
MIT License
337 stars 84 forks source link

how about retraining? #2

Open GallonDeng opened 5 years ago

GallonDeng commented 5 years ago

nice work! How about retraining? It will support retraining on new dataset? Thanks

see-- commented 5 years ago

I will add training scripts for smaller models on COCO. Training the hourglass network with 2 stacks won't be possible. It takes quite long and Keras/Tensorflow is not as fast and memory efficient as PyTorch. Do you have a specific dataset in mind?

GallonDeng commented 5 years ago

yes, I am trying to do a project with a real dataset to detect whether or not a worker wears an uniform and a helmet in a factory. The person scale changes a lot and the background is complex. Thus, I am trying STOA method with tensorflow framework.

LCWdmlearning commented 5 years ago

hello,Do you have updated training code? thanks!

ProblemFactory commented 5 years ago

Is there any plan for training code right now? Thanks!

see-- commented 5 years ago

No, there isn't a plan for adding training code. Sorry for the false promise. In terms of performance, I didn't get close to PyTorch. Here is a great summary of the problems: https://tensorpack.readthedocs.io/tutorial/philosophy/dataflow.html#alternative-data-loading-solutions. I also tried using tensorpack for better performance, but it is not fully compatible with keras (or tf-keras). Maybe tf-2.0 will change that.

Right now, I just use the official PyTorch code and port the model to TensorFlow when needed.

NEU-Gou commented 5 years ago

@see-- Thanks for the great repo! Could you please point me the code you used to port pytorch to tf.keras?

see-- commented 5 years ago

There is no code to do this automatically. The network is defined here: https://github.com/see--/keras-centernet/blob/master/keras_centernet/models/networks/hourglass.py. I named the layers so that they match with PyTorch weights. Maybe you mean the weight transplantation? I didn't include it as I didn't want a PyTorch dependency. You just iterate over all model.layers and retrieve the matching weights from nn.Module state_dict().

BTW I just found a nice repo that does create the network definition automatically: https://github.com/nerox8664/pytorch2keras

NEU-Gou commented 5 years ago

Thanks! I will give it a try.

shoutOutYangJie commented 5 years ago

No, there isn't a plan for adding training code. Sorry for the false promise. In terms of performance, I didn't get close to PyTorch. Here is a great summary of the problems: https://tensorpack.readthedocs.io/tutorial/philosophy/dataflow.html#alternative-data-loading-solutions. I also tried using tensorpack for better performance, but it is not fully compatible with keras (or tf-keras). Maybe tf-2.0 will change that.

Right now, I just use the official PyTorch code and port the model to TensorFlow when needed.

hey, thank for you work. How did you transfer pytorch model to tensorflow model? Your weights is directly transformed from official pytorch weights? I am looking forward to your reply

joyyang1215 commented 5 years ago

Good Suggestion, I'll go use pyTorch.

bhack commented 5 years ago

This impl seems to have some training scripts https://github.com/Stick-To/CenterNet-tensorflow/blob/master/README.md#train-your-own-data

see-- commented 5 years ago

Hmmm, I only found debugging stuff.

bhack commented 5 years ago

Cause it is component of him multinet Object Detection API repo https://github.com/Stick-To/Object-Detection-API-Tensorflow/blob/master/testcenternet.py

see-- commented 5 years ago

Yeah I found that. It looks like debugging to me. You seem to be more familiar. Does it reproduce the VOC results?

bhack commented 5 years ago

I've not run the session with that code. But seems that the original author had some VOC result. Try to ask to him at https://github.com/Stick-To/Object-Detection-API-Tensorflow/issues/9#issuecomment-497541135

see-- commented 5 years ago

Aha, the answer is no it doesn't.