TabakM / CameraTrapDetectoR

Automatically detect, count, and classify animals in camera trap images.
23 stars 7 forks source link

error downloading data from shiny app #3

Closed jpvanek closed 2 years ago

jpvanek commented 2 years ago
> runShiny("deploy")
Loading required package: shiny

Listening on http://127.0.0.1:3486
trying URL 'https://www.dropbox.com/s/r1pazpf8db2o003/fasterrcnn_5classes.pt?raw=1'
Warning in utils::download.file(url, path, mode = "wb") :
  cannot open URL 'https://www.dropbox.com/s/r1pazpf8db2o003/fasterrcnn_5classes.pt?raw=1': HTTP status was '404 Not Found'
Warning: Error in utils::download.file: cannot open URL 'https://www.dropbox.com/s/r1pazpf8db2o003/fasterrcnn_5classes.pt?raw=1'
  2: shiny::runApp
  1: runShiny

Got the package installed and running (didn't work until I upgraded from R v 3.6 to v4), got the shiny app to run, then hit this snag. Typo perhaps?

fjoyce commented 2 years ago

Issue seems to be specific to the file path for the general model.

I don't get the same 404 error when I tried using family for model_type

jpvanek commented 2 years ago

Trying the species model_type now, seems to be doing some downloading.

jpvanek commented 2 years ago

Is there an estimate for how long it should take to run (hours, days)? So the species model_type is still running (test data set of 183 photos) with some text printed to the console:

[W TensorImpl.h:1156] Warning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (function operator ())
[W faster_rcnn.py:95] Warning: RCNN always returns a (Losses, Detections) tuple in scripting (function )

Seems to be running successfully 9 minutes in.

fjoyce commented 2 years ago

I ran it on a smaller directory (43 photos) and it took a while (somewhere between 10 & 20 min?)

jpvanek commented 2 years ago

Good to know, I'll stop babysitting my monitor and go clean some dishes.

What factors influence time you think? Obviously my computer specs and number of images, but I imagine image size as well?

image 8 cores

TabakM commented 2 years ago

Thank you for reporting. I updated the general model URL. Please try again if you get a chance. On timing, it shouldn't take that long, especially with your RAM, John. So I'm not sure what's going on there. Did either of you try to run without installing Microsoft Visual C++?

mikeyEcology commented 2 years ago

@jpvanek These are the warnings that I cannot suppress that I'm referring to when the output says "two warnings will appear". They are not a problem. You should have a progress bar indicating that things are working, though. If you specified make_plots=TRUE, you can also look at those while it's running.

[W TensorImpl.h:1156] Warning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (function operator ()) [W faster_rcnn.py:95] Warning: RCNN always returns a (Losses, Detections) tuple in scripting (function )

jpvanek commented 2 years ago

Thanks for the update. I did install MV C++ before installing. The model is still running, will update when it completes.

Where would I find the progress bar? I left everything as default. Here's what my screen looks like:

image

jpvanek commented 2 years ago

Got impatient, so I stopped it. Ran it again with 5 images of a human, deer, squirrel, raccoon, and coyote. Got it to run!

predictions <- deploy_model(data_dir = 'C:/...Image Classificiation/Test Data 2', model_type = 'species', recursive = TRUE, file_extensions = c('.jpg', '.JPG'), labeled = FALSE, make_plots = TRUE, plot_label = TRUE, output_dir = NULL, sample50 = FALSE, write_bbox_csv = FALSE, score_threshold = 0.6, h = 307, w = 408, lty = 1, lwd = 2, col = 'red')

Inference time of: 35.61 seconds per image. So, looks like it would have taken about an hour and a half to run my original data set of 183 images.

Here is the output:

image

image

image

image

image

image

Seems to have ID'd the human correctly, found the raccoon and coyote, but ID'd them as similar species, and missed the deer and gray squirrel.

Seems promising though, I'll keep playing around with it.

rsmiller74 commented 2 years ago

John thanks for doing some evaluation.

Are you pulling the images across a network? It takes from .75 to 3 seconds per photo when I run it but I am running it on the same drive that contains photos.

You might play around with the score_threshold. Take a look at the bounding box output file and see if it found those animals but the score was too low to include.

Also be aware that we will be doing some additional model training within the next few weeks.

jpvanek commented 2 years ago

Hmm, no I don't think so. I have the folder in C: and R installed on C:. I'll keep playing around with it. Definitely seems user friendly and easy to run/view results.

Taking the kiddo to gymnastics, letting it run on a folder of 124 coyote only images.

TabakM commented 2 years ago

@jpvanek I wonder if running the model through the Shiny app is slowing it down. You could try running it in the console. After specifying all of your parameters in the Shiny App, you can copy the code at the top of the shiny window. Then instead of running the model through the shiny app, paste this code into the console and try that. More details at ?deploy_model

Regarding the progress par, that will only appear if you run directly in the console (instead of through the Shiny App).

Also, if you wouldn't mind, could you please open a new issue (something like "model running slowly") so that we can keep them organized by title. This one is no longer relevant for this conversation

mikeyEcology commented 2 years ago

I'm closing this issue as the downloading problem has been solved. @jpvanek if you have further questions about time to deployment, please open a new issue.