GithubHelp home page GithubHelp logo

tasinsahin / animaldetection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from szejkerek/animaldetection

0.0 0.0 0.0 170.72 MB

Sem. VI Neural networks created to detect animals hidden in their natural environments.

Python 100.00%

animaldetection's Introduction

Animal Detection in Camouflaged Environments

Introduction

This project was conducted as a part of the Biologically Inspired Artificial Intelligence course at the Silesian University of Technology. The goal of our project was to develop an advanced neural network utilizing machine learning techniques to effectively detect animals hidden in their natural environments. To achieve this task, we utilized the PyTorch library and the Segmentation Models repository.

Dataset

The dataset used for our research can be found in the !Dataset\Images directory of this repository. It consists of approximately 300 images featuring various animals in naturally camouflaging environments. During the data collection process, we took several aspects into account, including avoiding the central part of the frame and removing any overlaid text on the images. The dataset was prepared by the students involved in the project.

Below is an example image from the dataset along with its corresponding mask, which describes the presence of the animal in the image, the masking and non-masking backgrounds, and the attention-grabbing fragment.

rjcc7hj0

Example image with a camouflaged animal

ExampleMask Example mask overlayed on the image

Network Training

The training process of our neural network was performed on an "NVIDIA 1070 GamingX" graphics card with 8 GB VRAM. We achieved efficient and satisfactory training by utilizing the CUDA Toolkit. During the training, we experimented with various network settings and parameters. The testing process was a combination of empirical error searching and exploring new issues and solutions. In the following sections, we will describe in detail the differences between the selected approaches.

Program Output

In this section, we will provide a detailed description of the program's output, which was saved on the user's disk. Each training run saved multiple files, such as a file with learning statistics, a file with the neural network configuration, a file with the learning curve plot, and results from the test dataset. Below, we present these results with detailed explanations:

Example Learning Statistics - stats.cfg The file contains information such as:

  • Path to save statistics
  • Duration of the training
  • Number of epochs
  • Space for any notes

Example Neural Network Configuration - config.cfg The file contains information such as:

  • Uused weights for each class
  • Encoder
  • Encoder weights
  • Activation function
  • Model
  • Loss function
  • Optimizer
  • Learning rate
  • Batch size

Example Learning Curve and Loss Plot:

LearningCurve

Best Approach

After comparing different network settings, we have identified the best approach for our project. This approach yielded the most promising results and achieved a higher IoU score compared to the other configurations.

Approach:

  • Mask weights: (1, 0.05, 0.03, 0.01)
  • Model: UNet
  • Encoder: Resnet34
  • Batch size: 15
  • Activation function: Softmax2d
  • Loss function: CrossEntropy
  • Optimizer: Adam
  • Learning rate: 0.0001
  • Encoder weights: ImageNet
  • Sample result: IoU score of 0.51

By returning to the UNet architecture with pre-defined weights and utilizing a batch size of 15, we observed improved results. The network demonstrated less generalization, resulting in better animal detection performance. Based on these findings, we conclude that this approach provides the most optimal configuration for detecting animals in camouflaged environments.

Here are a few examples of output images obtained using the best approach: test_15

Output image 1 test_8

Output image 2 test_13

Output image 3 test_9

Output image 4 test_5

Output image 5 test_0

Output image 6 test_7

Output image 7

Run Locally

Follow these steps to run the project locally:

  1. Clone the project repository
git clone https://github.com/szejkerek/AnimalDetection.git
  1. Navigate to the project directory
cd AnimalDetection
  1. Install the required dependencies from the requirements.txt file located in the root folder. Make sure you have Python and pip installed.
pip install -r requirements.txt
  1. Install CUDA Toolkit (if not already installed) to utilize GPU acceleration. Refer to the official NVIDIA website for installation instructions specific to your operating system.

  2. Install the latest version of PyTorch. You can visit the official PyTorch website for installation instructions based on your system configuration.

  3. Run the main.py file to start the project

python main.py

Conclusions

Based on our project, we have drawn several conclusions. First and foremost, we have confirmed that using neural networks and machine learning techniques can be an effective tool for detecting animals in camouflaged environments. The solution we developed achieved good results, but there is still potential for further improvement. Through this project, we gained valuable experience in the field of machine learning and neural networks, which we can leverage in future projects. We also learned that conducting successful neural network training does not require supercomputers and can be done in a home environment.

License

This project utilizes the segmentation_models.pytorch library for advanced neural network architectures.

Qubvel. segmentation_models.pytorch. Retrieved from: https://github.com/qubvel/segmentation_models.pytorch

animaldetection's People

Contributors

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