Giter VIP home page Giter VIP logo

farm-animal-tracking's Introduction

Farm Animal Tracking Project

Project for tracking farm animals.Sample YT

Prerequisites

Instalation

Download repository and install dependencies

$ git clone https://github.com/burnpiro/farm-animal-tracking.git
$ cd farm-animal-tracking
$ pip install -r requirements.txt

Download detection model weights

  1. To download precompiled model weights Google Drive
  2. Unzip archive to model/detection_model

Download recognition model weights

  1. To download precompiled model weights Google Drive
  2. Unzip archive to model/siamese/weights

Running

Detection

To visualize animal detection on video use:

$ python show_prediction.py

or for image:

$ python run_detection.py

Tracking

To visualize animal tracking on video use:

$ python show_tracking.py --video=<path to video>

Dataset

Dataset for learning of model can be obtained at PSRG website.

Update 2023:

Dataset is no longer available through the university website. Please contact them directly to access the data as described in Issue 8

EDA (Exploratory Data Analysis)

  • Run:
docker-compose -f eda/docker-compose.yaml up
  • Go to localhost:8001 and enter token from console

Siamese network

You can download current best weights from Google Drive MobileNetV2 Google Drive EfficientNetB5 Google Drive ResNet101V2. Put them into ./model/siamese/weights and use the path as --weights parameter.

Training

Make sure you have cropped dataset in ./data/cropped_animals folder. Please check ./data/data_generator.py documentation for more info.

$ python train_siamese.py

Generate Embeddings for Test dataset and visualize it

Instead of running this script manually (requires ~30GB of RAM) you can use pre-generated train/test/concat files in ./data/visualization. Just select two files with the same postfix, vecs-$1.tsv and meta-$1.tsv, it's important to use the same postfix, otherwise length won't match.

$ python helpers/generate_siamese_emb_space.py

Options:

  • --datatype: either train or test (default train), which data should be used for embeddings
  • --weights: string (default siam-118_0.0633.h5), specify weights file from mode/siamese/weights/MobileNetV2/ folder

This is going to produce two files:

  • vecs.tsv - list of embeddings for test dataset
  • meta.tsv - list of labels for embeddings

You can visualize those embeddings in https://projector.tensorflow.org/ application. Just upload them as a custom data (use Load option).

Average class values - Video

Test day data - Video

Train all data - Video

Generate tracking data

$ cd data
$ python generate_tracking.py

This is going to produce tracking data from videos, so we can evaluate model. Look for frames_tracking.json and pigs_tracking.json inside ./data/tracking/. For more details check Wiki.

Testing two images

You can specify the weights for the model. Please use weights marked with the lowest number (loss value).

$ python test_siamese.py

Options:

--weights siam-118_0.0633.h5

farm-animal-tracking's People

Contributors

burnpiro avatar marekpokropinski 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

Watchers

 avatar  avatar  avatar  avatar

farm-animal-tracking's Issues

Access to data for trying out the code

Hi Kemal,
I was trying to get the data from the provided weblink, but the webpage seems to not be accessible. Is their another way I can get the data to try out your code for the Project?
psrg.unl.edu/Projects/Details/12-Animal-Tracking

weights

Hi, I'm glad to found this solution, I would like to try but the links corresponding to the weights are broken, could you help me with that?

thanks in advance

Cattle

Hi guys,

First, I would like to say you did a GOOD JOB in this repo!

Then, I have a few questions:

  • I have cattle data, the first step so is to put that data into the data/cropped_images/(id)?;
  • Can I train only the siamese network for feature extraction? and then only have a 64D output. I already have the images cropped by themselves because they were detected from another network and I only want to extract particular features for CattleRe-ID;
  • Can I change the code to output more dimensions? e.g 128,256...

I have about 60K cattle images of 100 classes. I think working with 128D or 256D would fit better to my problem.

Thanks in advance.

Tensorflow version

Hi

Looks like great stuff here, but I'm struggling to run it as I'm not sure what tensorflow version to use (I've tried the latest 2.7 and 1.15, but it looks like it's one of the inbetween versions!). Apologies if it's in the documentation somewhere but I couldn't find it.

best wishes

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.