Giter Club home page Giter Club logo

yebigithub / bw_dairy Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 38.05 MB

Depth video data-enabled predictions of longitudinal dairy cow body weight using thresholding and Mask R-CNN algorithms

Home Page: https://doi.org/10.1016/j.atech.2023.100352

R 0.62% Python 47.04% Jupyter Notebook 52.34%
3d-image-segmentation bodyweight computer-vision dairy-cow deeplearning depth-camera finetuning longitudinal-analysis machine-learning machinelearning-python

bw_dairy's Introduction

Depth video data-enabled predictions of longitudinal dairy cow body weight using thresholding and Mask R-CNN algorithms

This repo contains all the code used in Bi et al.(2023).

This repository includes:

  1. Quick sample code.
  2. Thresholding methods
    • 2.1 Single threshold method.
    • 2.2 Adaptive threshold method.
  3. Mask RCNN method
    • 3.1 LabelMe.
    • 3.2 Mask-RCNN method
      • 3.2.1 Training Mask-RCNN model
      • 3.2.2 Predict depth images by trained Mask-RCNN model.
  4. Build Body Weight Regression Model
    • 4.1 Data Preprocessing
    • 4.2 Goodness of fit
    • 4.3 Cross-Validation 1
    • 4.4 Cross-Validation 2

1. Quick sample code.

Attention: This sample code works with example images. For your customized images, many hyperparameters need to be adjusted.

1.1 Establish your environment.

# $ conda create --name <env> --file <requirement.txt>

1.2 Run image analysis.

Step1. Create outputs directory.

  • Build one empty folder named outputs within your local folder python which you downloaded from this github repository.
  • If you want to run for your own figures, please make sure your files following our Sample_files folder structure.

  • Please make sure the outputs folder is empty before running each image analysis method.

Step2. Choose one image analysis method.

Select one image analysis method below and run the related code block

  • Single threshold method:
python single_thr/ImageAnalysis_single_thr.py D1
  • Adaptive threshold method:
python adaptive_thr/ImageAnalysis_adaptive_thr.py D1
  • Mask R-CNN method:
python maskrcnn/ImageAnalysis_mrcnn.py D1

Step3. Check your outputs.

After running, each approach will generate one csv file in outputs/D1folder similar to the following.

2. Thresholding methods

2.1 Single threshold method.

2.2 Adaptive threshold method.

Main steps

animated

3. Mask RCNN method

3.1 LabelMe.

## How to used our customized LabelMe.
## Code used to start label png into json files.
labelme ./depth/cow.png -O ./outputs/cow.json

animated

# Code used to transfer json files into folders.
labelme_json_to_dataset ./outputs/cow.json -o ./outputs/cow_json

3.2 Mask-RCNN method

3.2.1 Training Mask-RCNN model

3.2.2 Predict depth images by trained Mask-RCNN model.

4. Build Body Weight Regression Model

4.1 Data Preprocessing

4.2 Goodness of fit

4.3 Cross-Validation 1

4.4 Cross-Validation 2

bw_dairy's People

Contributors

yebigithub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.