Giter VIP home page Giter VIP logo

deep_learning_for_camera_trap_images's Introduction

deep_learning_for_camera_trap_images

This repository contains the code used for the following paper:

Automatically identifying, counting, and describing wild animals in camera-trap images with deep learning

Authors: Mohammad Sadegh Norouzzadeh, Anh Nguyen, Margaret Kosmala, Ali Swanson, Meredith Palmer, Craig Packer, Jeff Clune

If you use this code in an academic article, please cite the following paper:

	@article {Norouzzadeh201719367,
		author = {Norouzzadeh, Mohammad Sadegh and Nguyen, Anh and Kosmala, Margaret and Swanson, Alexandra and Palmer, Meredith S. and Packer, Craig and Clune, Jeff},
		title = {Automatically identifying, counting, and describing wild animals in camera-trap images with deep learning},
		year = {2018},
		doi = {10.1073/pnas.1719367115},
		publisher = {National Academy of Sciences},
		issn = {0027-8424},
		URL = {http://www.pnas.org/content/early/2018/06/04/1719367115},
		eprint = {http://www.pnas.org/content/early/2018/06/04/1719367115.full.pdf},
		journal = {Proceedings of the National Academy of Sciences}
	}

Most of the code in this repository is taken from here

This repository has four independent parts:

1- The code used for Task I: Detecting Images That Contain Animals (phase1 folder)

2- The code used for Task II,III, and IV: identifying, counting, and describing animals in images (phase 2 folder)

3- The code used for Task II only, (all the transfer learning experiments for Task II used this part of the repo) (phase2_recognition_only folder)

4- resize.py is used for resizing the input images for all the other parts

For more information on how to use this repo please refer to the base repo at this link

1. Requirements

Requirements

To use this code, you will need to install the following:

  • Python 2.7
  • Tenorflow
  • NumPy
  • SciPy
  • MatPlot Lib

2. Running

Pre-trained models could be found at the following links:

  • Phase 1 (VGG architecture):

https://drive.google.com/file/d/1Y-aDWNMfvgYUb-u-_cqzibZ6ePFOOLGj/view?usp=sharing

  • Phase 2 (ResNet-152 architecture):

https://drive.google.com/file/d/1KTV9dmqkv0xrheIOEkPXbqeg36_rXJ_E/view?usp=sharing

  • Phase 2 recognition only (ResNet-152 architecture):

https://drive.google.com/file/d/1cAcnyBTO5JeB2zSaEoGBWf0Jd-jAnguS/view?usp=sharing

3. Licenses

This code is licensed under MIT License.

4. Questions?

For questions/suggestions, feel free to email, tweet to @arashnorouzzade or create a github issue.

deep_learning_for_camera_trap_images's People

Contributors

arashno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep_learning_for_camera_trap_images's Issues

Is it a best practice to remove camera software labels on input photos?

My end goal is to train a model with input from a number of different datasets across my study area.

I noticed that some cameras, e.g., ScoutGuard, label images just at the bottom left and right - e.g., "ScoutGuard 09.15.2010 17:05:01". The label has a grey background and black text.

Other cameras, e.g., Reconyx, will label images on the top and bottom on the image with a band of black background with white text.

I'm concerned that these areas of the photo will influence the decisions made by the machine learning algorithm. For one, the algorithm might associate one style of labels with certain species more common in that dataset. Secondly, the dark black or bright white in the labels will undoubtedly change the values of the entire image when the image is normalized before entering the machine learning process.

Did you remove these labels from the images before processing them in the machine learning algorithm you've used here?

I ask because I just figured I would have to do this, but wasn't sure if I was over-thinking it.

Can you please provide pb file?

If possible, can you please provide a pb file(TF Saved Model) for the pre-trained models instead of checkpoint files.

Please let me know.

Is the code in phase2/eval.py wrong?

The code in line 162 in phase2/eval.py :

true_top5_predictions_count+= top5_accuracy
true_top3_predictions_count+= top3_accuracy
one_bin_off_val+= obol_val

print(batch_format_str%(step, '[' + ', '.join('%.3f' % (item/(step+1.0)) for item in true_predictions_count) + ']', true_top5_predictions_count/(step + 1.0), true_top3_predictions_count/(step+1.0), obol_val/(step+1.0), accv_all/total_examples, prcv_all/total_examples, recv_all/total_examples))

I think the bold code obol_val is not right, but should be one_bin_off_val. Am I right?

Unclear how to use the code

Despite looking at the recommended repo, it's still a little unclear how to use this.

An example include an appropriately-formatted input file and a couple of example images would go along way towards making this useful to others.

Converting model to Pytorch

Hi @arashno ,

I need to convert your res152 recognition model to pytorch. I am using mmdnn for conversion, but I cannot find the output node which needs to be given to the mmdnn conversion command. I have visualized the graph using the meta file, and there is no name that looks like output, softmax or predictions.

Can you or anyone else help with the conversion?

Why is there no animal behavior? Doesn't the paper say you can predict exactly what an animal is doing

reslut:
1,b'/home/lf/\xe6\xa1\x8c\xe9\x9d\xa2/jpg/100.jpg',1,[1, 0],[0.9994, 0.0006]
2,b'/home/lf/\xe6\xa1\x8c\xe9\x9d\xa2/jpg/23.jpg',1,[1, 0],[0.9996, 0.0004]
But I didn't find the results of animal behavior,[0.9996, 0.0004]I think there are only top1 and top5 results, but there is no output of Top2-Top4 results
and:
Batch Number: 0, Top-1 Hit: 2, Top-5 Hit: 2, Top-1 Accuracy: 1.000, Top-5 Accuracy: 1.000
This is the result of a CMD command,I don't understand

EF_val.csv - how to get?

I was trying to run your code with pre-trained model.

Where can i find EF_val.csv.

Please let me know.

Pre-processing test images: normalizing a dataset

Hello there,

I am attempting to train and test a new image classification algorithm using the R package MLWIC provided in your recent paper, Tabak et al. 2018. I am an experienced R user but do not have experience in python.

I'm trying to process images to ready them for training and testing. In the Tabak et al 2018 paper, it mentions that authors followed methods in your recent publication (Norouzzadeh et al 2018 - appendix)

I have a few questions.

1. Am I correct in assuming that the train command in MLWIC performs "random cropping, horizontal flipping, brightness modification, and contrast modification" to each training image, as is recommended in both papers?

There is code provided within an "L1" folder that does seem to do this, but it's not clear (to me) if this code is leveraged during MLWIC::train. I did ask Mikey Tabak about this (here) and I wondered if you could provide any further clarification.

2. How is image normalization carried out for the test dataset?

When I read through the Norouzzadeh et al 2018 appendix (linked above) there is a section on the second page, second paragraph, that states:

After scaling down the images, we computed the mean and standard deviation of pixel intensities for each color channel separately and then we normalized the images by subtracting the average and dividing by the standard deviation.

I did some reading and found that some authors use the mean and standard deviation of the entire dataset, while others use the mean and standard deviation of each image. Forgive me this question is naive... (I am, after all, the intended "ecologist-not-data-scientist" audience for the program ๐Ÿ˜€) - did you use the mean and sd of each image, or of the whole dataset?

I have one final question but I feel that it is more general, so I've posted it on stackoverflow. If you do have time to check it out there, I would be very grateful for your two cents.

https://stackoverflow.com/questions/55306443/normalizing-an-image-in-r-using-mean-and-standard-deviation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.