This README provides a comprehensive guide for setting up, training, and running the Object Detection System. Follow these steps carefully to ensure successful execution.
Ensure that your Python version is compatible with the TensorFlow version required for this project. TensorFlow compatibility is a common issue; please verify and fix mismatches as necessary.
- Python Version: 3.x (preferably 3.10.11) Don't go above 3.11. Fails for that.
- TensorFlow Version: Check
requirements.txtfor the specific version.
Tip: Using a virtual environment is highly recommended to avoid conflicts with global Python packages.
-
Install Dependencies: Install all required packages by running the following command:
pip install -r requirements.txt
-
Verify Installation: Ensure that TensorFlow and other dependencies are correctly installed. If you encounter issues, double-check your Python and TensorFlow versions for compatibility.
Before proceeding, ensure you have the following files:
-
planesnet.json:- This file contains the data required to train the model.
- Place it in the root directory of the project.
-
Folder Structure:
Project_Directory/ ├── AI_Models/ │ └── model.tfl (Generated after training) ├── Landscape_Views/ │ └── (Output images will be saved here) ├── planesnet.json (donwload this from the website I gave below) ├── train.py ├── cnn_model.py ├── locator.py ├── requirements.txt └── README.md
The latest version of planesnet.json is available through the PlanesNet Kaggle page. This page also provides detailed information about the dataset layout, including the format and contents. Be sure to download the dataset from there and place the planesnet.json file in the root directory of your project.
Run the train.py script to train the model using planesnet.json. This will generate a .tfl model file in the AI_Models/ directory.
python train.py "planesnet.json" "model.tfl"Once the model is trained, execute the cnn_model.py script. This script uses the trained model to prepare for object detection tasks.
python cnn_model.pyTo detect planes in landscape images, run the locator.py script. Pass the trained model and the image file as arguments.
Example command:
python locator.py "model.tfl" "Landscape_Views/landscape_A.png"After successful execution, the output will be saved in the Landscape_Views/ folder. The output file will include the processed image with detected planes marked.
-
TensorFlow Version Mismatch:
- Verify your Python version matches the TensorFlow requirements.
- If using a virtual environment, recreate it to avoid conflicts:
python -m venv venv source venv/bin/activate # On Linux/Mac venv\Scripts\activate # On Windows pip install -r requirements.txt
-
Missing
planesnet.json:- Ensure the file is in the root directory.
- Without this file, the model training will fail.
-
Model File Not Found:
- Ensure the
train.pyscript is executed successfully to generate the model file in theAI_Models/directory.
- Ensure the
-
Image File Issues:
- Check that the input image path passed to
locator.pyexists and is correctly formatted.
- Check that the input image path passed to
python model/locator.py model/model.tfl model/Landscape_Views/landscape_A.png
python locator.py "model.tfl" "Landscape_Views/landscape_A.png" "imageid1"
& C:/Users/{{User}}/AppData/Local/Programs/Python/Python310/python.exe c:/Users/{{User}}/OneDrive/Desktop/Captsone/model/object_extraction_from_db.py