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.

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

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.