-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ResNet50 backbone #14
Comments
Hi Ross, Is there an ETA on this? Do you need help? |
@selzero it's still on the list of things to do (eventually), but not highest priority for me right now. One thing that makes it a little more work than I'd hoped was that it uses a different model format (see PR is welcome Have you tried the new models via TFJS? Noteworthy improvement? |
@rwightman The ResNet50 model is very accurate, but as you can imagine, it's also very heavy. Newer laptops like a new Macbook Pro can handle fine, but a Macbook Pro 2014 couldn't handle it for streaming. Regarding the new format, I think they just moved from building each layer manually to a pre-set graph with the weights and bias combined. That avoids loading the dozen of files. Also, seems they are training the model with python, so it just converts to tfjs and it's good to go without having to update all the js code to adapt to different layers, weight files, bias, etc. |
I found this ResNet50 model is tfjs_graph_model which generated by tfjs-converter. but tfjs-converter doesn't provide a function to convert tfjs_graph_model to python model. |
We have achieved much better accuracy with the ResNet50 model. Accuracy also means we are getting less "flicker" on the keypoints. It's pretty easy to run the latest posenet demo and select ResNet50 from the drop down to see the difference. |
@selzero , have you tried , perhaps on saved videos , rather than streaming of videos ? |
@timtensor we have to use it on webcam. ResNet50 is giving us better and more stable predictions. |
@rwightman also very interested in the resnet50 adaption! Will also start working on it, and maybe help with a pr! Keep us posted on your progress! |
How can I put resnet50 into this code to run? Now the reliability of mobilenet is too low. |
New model format is a serious problem. It seems that tfjs encode all weights in four .bin files which I have no idea how to extract weights from them. Is there any progress? |
Because I want to be recognized by people, I turned to reid. @darcula1993 |
Is there any progress about ResNet implementation? |
@jendonyuen Is there any progress about ResNet implementation? |
It seems that I have to ask my colleagues in charge of the front end to assist me and transmit the results to me in real time |
Nope...We turn back to node.js and build tfjs-node on arm boards... |
tensorflow/tfjs#1575 (comment) |
@jendonyuen thank you for the above links. I am reading the posts about converting tfjs models to tf ones, however I am getting lost. Would you have a simple script or working example in which a ResNet architecture has been implemented in Python? Any help is very welcome as I am really stuck. Thanks |
@jendonyuen it's good to see someone taking a crack at it, but would have been nice to have a reference back to this as he pretty much took my code with no acknowledgement |
I was working on a ResNet50 integration in parallel with the above implementation: https://github.com/atomicbits/posenet-python I also focused on running it on Tensorflow 2.x and transforming the tensorflow.js models to the tensorflow saved model using https://github.com/patlevin/tfjs-to-tf Not everything is idiomatic TF2 yet, though... Let me know what you think... |
I already created tf.keras h5 format Mobilenet model using tfjs-to-tf under tf2.0. Here are the model files. |
@darcula1993 @rigolepe Does resnet50 have any model files? |
@gzchenjiajun The code automatically downloads the model files if you don't have them yet and transforms them into a TensorFlow For example, the tensorflow.js (javascript) resnet50 model json file for posenet is hosted here: |
@rigolepe looks good! so it's running with the ResNet50 model, what sort of framerate do you get with a modest GPU running the (non rendering) test? |
Running the multi-pose benchmark cycling 1000 times through the example images on a Geforce GTX 1080ti gives these average FPS using TF 2.0.0:
I can't explain why the larger stride gives a faster result. It was expected that MobileNet would be faster than ResNet50, but the MobileNet quality is visibly lower on the rendered images (running image_demo.py). I see that you were in quite a faster range (90-110fps) with MobileNet on an identical GPU, but that was probably for a single pose detection? The MobileNet test above is done with the 101 model (multiplier = 1.0), lowering the multiplier and the quant bytes with stride 16 gives:
Lowering the quant bytes on ResNet50 doesn't improve the speed. |
@rigolepe thanks for the in depth numbers, the mobilenet numbers are a bit odd, I was seeing closer to double the performance for mobilenet 101 in the TF1 version, perhaps TF2 adds that much overhead? That was multi-pose, default args, as the application I built it for had no use for single. Running on either a 1080ti or 1080 back then. Regarding the striding that makes sense. The network stride means the output feature maps are roughly 1/stride of the input size (with typical rounding/flooring along the way that depends on the padding settings). So a stride 8 network has much larger feature maps through the later layers than a standard stride 32 (default for most of the backbone networks when trained on imagenet at 224x224). |
BTW, something that can easily be done in TF 2, that would have been a pain in the ass in TF 1 graph land is an optimization I made for my PyTorch port, keeping the See: https://github.com/rwightman/posenet-pytorch/blob/master/posenet/decode_multi.py#L27 |
It seems the python version of resnet is much slower than the javascript one, is there any clue for it? |
anyone has the resnet50 model? |
It is downloaded automatically when you choose |
Thanks for your terrific work @rigolepe |
No, the choice of CPU vs GPU shouldn't make any difference on the accuracy. All network operations are the same in both cases, just executed slower on the CPU. I also want to point out that most of the hard work was done by @rwightman I merely did the structural upgrades to support the new model formats and support for TF2.x |
@festapp86 please see the conversation in this old issue: #11 ... it's a good summary of things to look at, the input images are important, their resolution, scale, brightness, etc... in live situations even something simple like turning on a light can greatly increase the accuracy |
@rwightman |
@rwightman @rigolepe |
When I am installing the dependencies I am getting these: When try to fix one of them for example, pip install six==1.12.0 I am getting: And when I run: Can someone please help me understand why this is happening? I am not using docker configuration and my machine has no GPU support. |
It looks like you are manually installing all the dependencies. You get this error when installing https://github.com/patlevin/tfjs-to-tf.git because it depends on See my Dockerfile for how to install |
@rigolepe thanks for the quick response dear. I really appreciate that. I have installed all the dependencies as described in the instructions by you there:
Thanks |
No, you don't need to use docker, you can also install it manually on your system using the commands in the Dockerfile. That should work just as well. |
Hi, When i try to load mobilenet stride 16 quant 4 multiplier .75 using this repo -https://github.com/atomicbits/posenet-python/blob/master/image_demo.py Can anyone tell me why there is difference between accuracy of keypoints while loading the same model through tf1 and tf2. |
Add resnet50 backbone as an option, as per: tensorflow/tfjs-models#199
The text was updated successfully, but these errors were encountered: