-
Notifications
You must be signed in to change notification settings - Fork 15
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
object detection models in R? #54
Comments
We still haven't implemented those for R. To my knowledge there's a If you want to port them I'd start by implementing the generalized rcnn module: and then go to the specialization: you will also probably need to convert this: https://github.com/pytorch/vision/blob/master/torchvision/models/detection/backbone_utils.py In general, translation these requires basic knowledge of Python, to be able to convert the loops and if statements. Also, you should also not need to care about scripting, so you can ignore |
Thank you @dfalbel . We'll get working on it. I trained the model in python, but I'm trying to make it deployable in R as I'm making an R package for ecologists (to evaluate camera trap images). After making the package, we'll be writing this up as a manuscript. If you're interested in participating in writing this code I'd be happy to include you as a co-author. Please let me know if you're interested: mtabak@west-ulc.ca |
Since you already trained the model in python you could jit save it with This requires dev version of torch though. |
Thank you @dfalbel ! This looks like a great option. It would be a huge advantage to not have to port the code to R. I have tried this, but I got an error when trying to load into R because it cannot load the nms function. Any suggestions for this? In python, I ran:
Then in R I ran:
But I get this error:
|
Hmm this is tricky. It seems that torchvision register some custom TorchScript operations and they wouldn't be available at the time we This is definitely on my todo list for the next few months, but will probably take some time to figure out the best way to do it. |
Yes-I can understand why this will be tricky. We'll be working on the same problem on our end as we need to include this in an R package. Please let me know if you'd like to collaborate on the effort. Clearly, you are much better at this than us, but our team includes a talented programmer who can also contribute. |
Sure I am happy to collaborate!
Now, from R:
I am not sure if this would work on Windows, but sound like it should just work. The model I saved from python using:
So In theory, provided that this works on Windows what we could do to support running these models from R is:
|
Thank you. This looks like a great option. I have not been able to build and create that file. Would you be willing to share the |
I'm having a new problem when I try to load a state_dict from python into R. I'm not having problems with the .pt file that I created above. I'm wondering if this is due to the pytorch version. I'm currently using 1.9.1 (previously 1.7). I'm using R torch version 0.6.0; R version 4.1.1.
Then to load the model in R:
I get this error:
Any suggestions? Should I try reverting to an older version of pytorch? |
I think you want to use |
Thank you! My mistake. I was trying to load the architecture as if it was the weights. |
Hi,
I'd like to deploy an object detection model in R and I'm wondering if there is a function to do this? I see that there are some object classification models available, so I'm not sure if I'm missing them or if they're not available. I would like to use faster rcnn analogous to the one implemented in pytorch. Is this available? If not, do you have any tips for me in trying to develop this?
Thank you
The text was updated successfully, but these errors were encountered: