This project is a comprehensive suite of tools designed for various image processing tasks including augmentation, cropping, grayscaling, and a set of operations related to modeling. The toolkit is structured around a Python-based application (app.py
) that serves as the entry point to use the four individual scripts:
- augumentation.py: For image augmentation operations.
- cropping.py: To crop images to specified dimensions.
- grayscaling.py: For converting images to grayscale.
- modeling.py: To control our model operations such as training, evaluating, and applying the model to predict wear of cutting tools for milling machines.
- segmentation.py:
- wear_measurement.py:
Ensure that Python 3.x is installed on your system. The scripts also require additional libraries, details of which can be found in the requirements.txt
file. Install the required Python libraries using:
pip install -r requirements.txt
or use conda
conda env create -f environment.yml
Clone the repository or download the source code to your local machine. Ensure all scripts (augumentation.py
, cropping.py
, grayscaling.py
, modeling.py
, and app.py
) are in the same directory, or adjust the paths in app.py
accordingly.
Navigate to the project directory and run the following command in the terminal:
python app.py
Follow the on-screen prompts to select the desired operation and provide necessary inputs as requested.
-
Image Augmentation
- Perform various image transformations like rotation, scaling, and flipping to augment your image dataset.
-
Image Cropping
- Crop images to a specified width and height.
-
Image Grayscaling
- Convert color images to grayscale, optionally categorizing pixel values into classes.
-
Model Operations
- Manage operations related to a machine learning model, including training, loading, evaluating, and making predictions.
Upon launching app.py
, you will be presented with a menu to choose from the following options:
- Image Augmentation: Enter paths for input and output directories.
- Image Cropping: Provide input and output directory paths along with the desired dimensions for cropping.
- Image Grayscaling: Specify the directories for reading and writing grayscale images.
- Model Operations: Choose from loading, training, or evaluating the model, and provide necessary paths (images folder and masks folder). When you just use the package, after you initiation
model = WearDetector()
you should callmodel.load_data()
function for training the model (both ofmodel.train()
andmodel.grid_search_train()
). And usemodel.evaluate(X,y, verbose=1)
andmodel.predict( images_dir, verbose=0)
for evaluation and prediction base on the dataset you give (X,y as well as images_dir).
Contributions to enhance functionalities or improve the efficiency of existing scripts are welcome. Please fork the repository and submit a pull request with your updates.