keras-centernet icon indicating copy to clipboard operation
keras-centernet copied to clipboard

how about retraining?

Open GallonDeng opened this issue 6 years ago • 16 comments

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

GallonDeng avatar May 08 '19 04:05 GallonDeng

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?

see-- avatar May 08 '19 06:05 see--

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.

GallonDeng avatar May 08 '19 07:05 GallonDeng

hello,Do you have updated training code? thanks!

LCWdmlearning avatar May 15 '19 10:05 LCWdmlearning

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

ProblemFactory avatar Jun 05 '19 07:06 ProblemFactory

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.

see-- avatar Jun 06 '19 14:06 see--

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

NEU-Gou avatar Jun 13 '19 14:06 NEU-Gou

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

see-- avatar Jun 14 '19 21:06 see--

Thanks! I will give it a try.

NEU-Gou avatar Jun 17 '19 08:06 NEU-Gou

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

shoutOutYangJie avatar Jun 20 '19 11:06 shoutOutYangJie

Good Suggestion, I'll go use pyTorch.

joyyang1215 avatar Jul 09 '19 09:07 joyyang1215

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

bhack avatar Jul 12 '19 21:07 bhack

Hmmm, I only found debugging stuff.

see-- avatar Jul 12 '19 23:07 see--

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

bhack avatar Jul 13 '19 09:07 bhack

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

see-- avatar Jul 13 '19 11:07 see--

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

bhack avatar Jul 13 '19 14:07 bhack

Aha, the answer is no it doesn't.

see-- avatar Jul 13 '19 14:07 see--