This Python script can be used to train a convolutional neural network (CNN) model on a dataset of images and then use the trained model to perform real-time object detection on live video frames.
- Clone the repository to your local machine using the command
git clone <repository_url>
. - Install the required packages using the command
pip install -r requirements.txt
.
- Set the directory containing the dataset of images by changing the
dataset_dir
variable in the script. - Set the input shape of the images by changing the
input_shape
variable in the script. - Split the dataset into training and testing sets by changing the
test_size
parameter in thetrain_test_split
function. - Set the number of epochs and batch size for training by changing the
epochs
andbatch_size
parameters in themodel.fit
function. - Run the script using the command
python object_detection.py
. - The script will train the CNN model on the dataset and save the trained model to a file named
model.h5
. - The script will also open a live video stream and perform real-time object detection on the frames using the trained model. The predicted label for each frame will be displayed on the video.
Note: The script assumes that the dataset of images is organized into subdirectories, with each subdirectory containing images of a single class. The name of each subdirectory is used as the label for the images in that subdirectory. If your dataset is organized differently, modify the script accordingly.
This project was created by NSTHEHACKER . If you have any questions or feedback, please feel free to contact me at [email protected] .
This project is licensed under the MIT License - see the LICENSE file for details. <------------------------------------------------------------------------------------------------------>
This Python script can be used to resize images in a directory to a specified target size. The resized images are saved to a specified output directory.
- Clone the repository to your local machine using the command
git clone <repository_url>
. - Install the required packages using the command
pip install -r requirements.txt
.
- Set the directory containing the images by changing the
image_directory
variable in the script. - Set the target size for resizing by changing the
target_size
variable in the script. - Set the directory to store resized images by changing the
output_directory
variable in the script. - Run the script using the command
python resize_images.py
. - Check the output directory for the resized images.
Note: The script only resizes images with the file extensions ".jpg" and ".png". If you have images with other file extensions, modify the script accordingly.