lucasxlu / XCloud

Open Source Deep Learning Serving System with Web Interface
https://arxiv.org/pdf/1912.10344.pdf
MIT License
69 stars 23 forks source link

Age model #3

Closed nerddd closed 4 years ago

nerddd commented 4 years ago

hi,will you release your age estimation model after transformed to tensorRT?

lucasxlu commented 4 years ago

Hi, @nerddd . The pretrained model of age estimation is not provided yet. You can train from scratch using this code base, and convert to TensorRT using model_converter.py.

Hope it helps.

nerddd commented 4 years ago

@lucasxlu Ok,the UTKFace dataset you used for training is "in the wild faces" or "aligned&cropped faces"?

nerddd commented 4 years ago

Did you treat age estimation as a classification task not a regression task?

lucasxlu commented 4 years ago

@nerddd I use aligned version. I try to treat the age estimation as a classification task inspired by this paper. You can also set the last output neuron as 1, remove softmax layer, and adopt MSE Loss/L1 Loss/SmoothL1 Loss as supervision to train a regression net. Or adopt ranking/label distribution learning methods to achieve better performance.

nerddd commented 4 years ago

@lucasxlu Yeah, I see. I used to adopted label distribution learning method for training. But I have problem in tranforming the model into tensorRT.

nerddd commented 4 years ago

@lucasxlu hi, I've used your script to train age estimation model from scratch using the code you provided, and convert to TensorRT using model_converter.py. But the inference speed is not that fast. Ubuntu 16.4 TensorRT 6.0.1.5 CUDA:10.0 GPU: GeForce GTX 1080 Network: ResNet18 pytorch: 12 FPS TensorRT:12 FPS

Is that normal? Could you please give me some help? Thank you

lucasxlu commented 4 years ago

@lucasxlu hi, I've used your script to train age estimation model from scratch using the code you provided, and convert to TensorRT using model_converter.py. But the inference speed is not that fast. Ubuntu 16.4 TensorRT 6.0.1.5 CUDA:10.0 GPU: GeForce GTX 1080 Network: ResNet18 pytorch: 12 FPS TensorRT:12 FPS

Is that normal? Could you please give me some help? Thank you

I tested ResNet18 on one 2080TI GPU. PyTorch model achieves 86.47 FPS, while TensorRT model achieves 62.25 FPS. It seems abnormal even with GTX 1080. Which version of CPU you used in your experiment? The speed may be slowed by image file loading.

nerddd commented 4 years ago

@lucasxlu My CPU is Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz, 8 cores. But in your result, it seems that TensorRT doesn't help with acceleration. PyTorch model is faster. Maybe you can try by setting the the parameter "fp16=False" in model_converter.py.

lucasxlu commented 4 years ago

@lucasxlu My CPU is Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz, 8 cores. But in your result, it seems that TensorRT doesn't help with acceleration. PyTorch model is faster. Maybe you can try by setting the the parameter "fp16=False" in model_converter.py.

I have tried before. TensorRT doesn't help acceleration with shallow nets (like ResNet18). But it works with a deeper net (such as DenseNet121, DenseNet169, and etc.) with 5 times faster.

lucasxlu commented 4 years ago

Hi, @nerddd could you please share your pretrained model? I will try to convert to TensorRT model on my server, and report FPS of different models respectively.

nerddd commented 4 years ago

@lucasxlu yeah, but I just used your script with ResNet18, training on MegaageAsian dataset. I didn't make a promise on accuracy. I stopped training before convergence. haha I just want to check whether TensorRT helps with acceleration.