python3 -m venv ./venv
source ./venv/bin/activate
pip install -r requirements.txt- Download the first dataset and place it in
./data/d1.zip - Download the second dataset and place it in
./data/d2.zip - Download the third dataset and place it in
./data/d3.zip - Run the following commands from the project root (
./):
unzip ./data/d1.zip -d ./data/d1
unzip ./data/d2.zip -d ./data/d2
unzip ./data/d3.zip -d ./data/d3preprocess.ipynb— Processes and combines the three datasets into one and stores it in CSV format astrash.csv.feature_extraction.ipynb— Uses a ResNet (CNN) model to extract features from each image intrash.csvand stores them infinal.csv.
random_forest_model.ipynb— Uses a Random Forest classifier and achieves 99.17% accuracy.xgboost_model.ipynb— Uses the XGBoost algorithm and achieves 99.61% accuracy.lightgbm_model.ipynb— Uses the LightGBM algorithm and achieves 99.63% accuracy.
Note:
Since it might take several hours to generate final.csv in feature_extraction.ipynb, you can directly download it from Google Drive and place it in ./data/final.csv.
Now you can test the model on your own images! To do this:
- Download or provide an image.
- Run the following command with the correct path to your image:
python3 inference.py path/to/image