mikeyEcology / MLWIC

Machine Learning for Wildlife Image Classification
69 stars 16 forks source link

Pig/Not Pig algorithm #33

Open Nova-Scotia opened 4 years ago

Nova-Scotia commented 4 years ago

Hi Mikey,

In the bioRxiv version of your paper, I read about your "Pig/no pig" model. We're interested in testing that model - are you able to share that one?

mikeyEcology commented 4 years ago

Hi Erica, I might be able to dig up that model and make it available. I have a couple of questions though: Are you planning on using this to ID empty images specifically (ie. determine if a picture is animal/ no animal) or are you workin on images with pigs? What kind of timeline are you working with? I ask because I'm currently training a model to detect animals in images that I think will be pretty effective because we have training data from a lot of locations. This will be available in the next version of MLWIC, but it is taking a long time to train and is about 2 months away from completion. Mikey

Nova-Scotia commented 4 years ago

Hi Mikey,

Thanks for the quick reply! We're curious about how well the model does with specifically "pig" or "no pig" (versus "animal" vs "no animal"). The earliest we would need it would likely be mid January, but perhaps as late as early February. The new algorithm sounds exciting - we will be keen to try it out! Shall I touch base with you in January and see where you are at (here or via email better)?

On Mon, Dec 2, 2019 at 1:03 PM mikey_t notifications@github.com wrote:

Hi, I might be able to dig up that model and make it available. I have a couple of questions though: Are you planning on using this to ID empty images specifically (ie. determine if a picture is animal/ no animal) or are you workin on images with pigs? What kind of timeline are you working with? I ask because I'm currently training a model to detect animals in images that I think will be pretty effective because we have training data from a lot of locations. This will be available in the next version of MLWIC, but it is taking a long time to train and is about 2 months away from completion. Mikey

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mikeyEcology/MLWIC/issues/33?email_source=notifications&email_token=AJCX4TUBHNW4XUDD4X36SP3QWVEX5A5CNFSM4JTYVGE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFULKXQ#issuecomment-560510302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCX4TW5WUECOUAQMDLUQ2DQWVEX5ANCNFSM4JTYVGEQ .

mikeyEcology commented 4 years ago

For anyone reading this issue in the future, we switched to email for discussion, but I am making this trained model available by request, so please comment on this issue if you would like to use this model.

Nova-Scotia commented 3 years ago

Hi again Mikey,

I've finally got my test images ready to go to try out the Pig/No Pig model. I've got everything working with these images when I test using MLWIC and the 26-species model. But I'm really having trouble with the Pig/No Pig model. The classify code seems to expect the main folder to be called "L1" no matter what I specify, so I've named the "Pig/No pig" model folder you provided "L1", since otherwise the function keeps dropping files into that folder anyway. I've used the "USDA50.log" file to guide me in choosing appropriate parameters for the classify call. I've taken some screenshots to show you the folder hierarchy so we can ensure I've got stuff in the right place:

image

inside architectures:

image

Here's the code and my error message (it does not produce the indicated predictions file):

classify( 

  # this is the absolute path to the images containing wildlife to classify.
  # No images should have more than one species, but there can be more than one individual of the same species.
  # There should be NO subdirectories in the "images" folder.
  path_prefix = "C:/Users/NewtonEr/MyFiles/Management/IMF/CameraTraps/TestMLWIC/Pig_pics_twocams",   

  # this is the location of the .csv containing image information. It has Unix linebreaks and no headers.
  # The first column contains the file name of the jpg image e.g., "CA-01_0006501.jpg"
  # The second column MUST contain the NUMBER corresponding to the species in the image, e.g., 25 - this can be used to check the accuracy of the classification. DO NOT LEAVE IT BLANK OR IT WILL NOT WORK.
  # This file MUST be named data_info.csv and it MUST be located in the L1 folder.
  data_info = "C:/Users/NewtonEr/MyFiles/Management/IMF/CameraTraps/TestMLWIC/L1/data_info.csv",  

  # This is where you stored the L1 folder in Step 3 of the instructions at: 
  # github.com/mikeyEcology/MLWIC/blob/master/README
  model_dir = "C:/Users/NewtonEr/MyFiles/Management/IMF/CameraTraps/TestMLWIC",  

  # the location of Python on your computer. 
  # NOTE you MUST have a slash ("/") at the end of the path!!!
  python_loc = "C:/Users/NewtonEr/Anaconda/",  

  os = "Windows", 

  log_dir = "USDA50", 

  depth = "50",  # I've tried quoted and unquoted, and numbers 8, 18, 50

  num_classes = 2, 

  top_n = "2",  # I've tried quoted and unquoted

  # Model_predictions.txt is the default, and you should use it unless you have reason otherwise.
  save_predictions = "model_predictions_pigs_PigNoPigModel_2021.txt" 
)

Traceback (most recent call last):
  File "eval.py", line 15, in 
    import arch
  File "C:\Users\NewtonEr\MyFiles\Management\IMF\CameraTraps\TestMLWIC\L1\arch.py", line 1, in 
    import architectures.alexnet
  File "C:\Users\NewtonEr\MyFiles\Management\IMF\CameraTraps\TestMLWIC\L1\architectures\alexnet.py", line 2, in 
    import common
ModuleNotFoundError: No module named 'common'
[1] "evaluation of images took 3.53698897361755 secs. The results are stored in C:/Users/NewtonEr/MyFiles/Management/IMF/CameraTraps/TestMLWIC/L1/model_predictions_pigs_PigNoPigModel_2021.txt. To view the results in a viewer-friendly format, please use the function make_output"