Skip to content
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

how can I save the result of image_darknet_model into a R object? #4

Closed
rmenoli opened this issue Aug 11, 2017 · 7 comments
Closed

Comments

@rmenoli
Copy link

rmenoli commented Aug 11, 2017

Hi!
I tired this code:


yolo_tiny_voc <- image_darknet_model(type = 'detect', model = "tiny-yolo-voc.cfg", weights=system.file(package="image.darknet", "models", "tiny-yolo-voc.weights"), labels = system.file(package="image.darknet", "include", "darknet", "data", "voc.names"))

x<-image_darknet_detect(paste(getwd(), "/tempPicture.jpg", sep=""), object = yolo_tiny_voc)


The output of this code is :


layer     filters    size              input                output

    0 conv     16  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  16

    1 max          2 x 2 / 2   416 x 416 x  16   ->   208 x 208 x  16

    2 conv     32  3 x 3 / 1   208 x 208 x  16   ->   208 x 208 x  32

    3 max          2 x 2 / 2   208 x 208 x  32   ->   104 x 104 x  32

    4 conv     64  3 x 3 / 1   104 x 104 x  32   ->   104 x 104 x  64

    5 max          2 x 2 / 2   104 x 104 x  64   ->    52 x  52 x  64

    6 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128

    7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128

    8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256

    9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256

   10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512

   11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512

   12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024

   13 conv   1024  3 x 3 / 1    13 x  13 x1024   ->    13 x  13 x1024

   14 conv    125  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 125

   15 detection

Loading weights from   ---------------------/R/x86_64-pc-linux-gnu-library/3.3/image.darknet/models/tiny-yolo-voc.weights...Done!

--------------------------/tempPicture.jpg: Predicted in 2.397771 seconds.
Boxes: 845 of which 1 above the threshold.

person: 93%

So the model detect one person into the image.
I wish save into x that te model detect one person. But the value of x is NULL

I tried also the function capture.output() to capture the fact that the model find a person in the image but the result of

capture.output(image_darknet_detect(paste(getwd(), "/tempPicture.jpg", sep=""), object=yolo_tiny_voc))

is charather(0).

Could you help me? It seem impossible extract the result of the detection.

Ty

P.S. I would detect 1000 image and put the result of the detection in a model like randomForset in order to predict a value for this reason I wish put the result of the detection in a data.frame

@jwijffels
Copy link
Contributor

Currently image_darknet_detect only gets the location of the object in C and spits out an image in your getwd() folder which shows that.
If you need a data.frame as output, you might be more interested in ?image_darknet_classify

@rmenoli
Copy link
Author

rmenoli commented Aug 11, 2017

I m not interested in classify the image(for example if the subject of the image is a cat a dog or a person) I'm interested in understand if the number of person (or the presence of a dog or a cat) in the picture gives to the image a higher probability to be successful in social networks. For this reason I'm interested in detection and not interested in classify. I saw that the last output of the function is

Boxes: 845 of which 1 above the threshold.

person: 93%

If it is possible save this text into a character variable I would resolve my issue. Is there any possibility that R read this text? In may tries it seems that this text is not a object that R can read, but I can make Copy and Paste on it.

Ty

@jwijffels
Copy link
Contributor

Currently this is not implemented, I haven't brought these numbers from the C side to the R side.

@rmenoli
Copy link
Author

rmenoli commented Aug 11, 2017

Ty
I'm sorry about it! The model is very interesting, I hope you'll implement it as soon as possible! I'll recommend this package to all my friend!

@jwijffels
Copy link
Contributor

If you want it soon for a commercial project, you can always request for it at www.bnosac.be, in case a non-free proposal can be made. If not, you'll have to wait.

@jwijffels
Copy link
Contributor

Closing as no active feedback given in last month.

@odel-odel
Copy link

Hi,
I am also intersted in this feature of having the output of detect function in a variable or dataframe in R
Thanks,
Odel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants