Giter Club home page Giter Club logo

fruitdetector's Introduction

Fruit Detector

This project is used to detect the 3D position of following fruit ๐ŸŽ:

Fruit ID Name
0 Banana
1 Peeled Orange
2 Cut Pomegranate
3 Grapes
4 Raspberries
5 Apple
6 Orange
7 Pomegranate

Note that apple and orange may be removed in the future

The output 3D position (xyz) represent the offset from the origin (position of camera) in term mm

How to use

1. Set up Anaconda environment

Step 1: Install Anaconda

  1. Download the Anaconda installer for Linux from the official website.
  2. Open a terminal.
  3. Navigate to the directory where you downloaded the installer.
  4. Run the following command to install Anaconda: bash Anaconda3-2021.05-Linux-x86_64.sh (replace with the name of the file you downloaded).
  5. Follow the prompts on the installer screens.
  6. If you are unsure about any setting, accept the defaults. You can change them later.
  7. To make the changes take effect, close and then re-open your terminal window.

Step 2: Create an Anaconda Environment

  1. Open a terminal.
  2. Navigate to the directory containing the environment.yaml file.
  3. Run the following command to create an environment: conda env create -f environment.yaml.
  4. Activate the new environment by running: conda activate myenv (replace myenv with the name of your environment, which is specified in the environment.yaml file).

Now you have set up your Anaconda environment and are ready to start using it!

2. Configura fruit detector

In configs/locator.yaml, please change the configuration model.weight to the path to the model. Here is the example

color_camera:
  fx: 912.782470703125
  fy: 912.799072265625
  cx: 641.11669921875
  cy: 370.3597106933594

depth_camera:
  fx: 636.6630249023438
  fy: 636.6630249023438
  cx: 647.2459716796875
  cy: 355.68048095703125

model:
  weight: /home/davidwong/documents/FruitDetector/outputs/yolom_20240306/weights/best.pt
  conf: 0.5
  height: 720
  width: 1280

3. Get 3D position

Read and try to run the code demo.py. You need to provide the input .png image and the .npy depth map.

Here is an example:

python demo.py --image_path <path to png image> --depth_path <path to .npy depth map>

Replace the corresponding input to the absolute path of required file

Addition setup

If you want to show the result of object detection, you can execute the following command

python demo.py --image_path <path to png image> --depth_path <path to .npy depth map> --show_output

If you want to save the result as image, you can execute the following cammand

python demo.py --image_path <path to png image> --depth_path <path to .npy depth map> --save_output

It will save the output to the default folder ./location_results

If you want to specify the location results folder, you can execute the following cammand

python demo.py --image_path <path to png image> --depth_path <path to .npy depth map> --save_output --output_folder <path to output folder>

fruitdetector's People

Contributors

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