-
Install virtualenv if you haven't already:
- Note: Depending on your system and how Python is installed, you may need to use
pipinstead ofpip3to ensure you are using Python 3.
pip3 install virtualenv - Note: Depending on your system and how Python is installed, you may need to use
-
Create a virtual environment in the project directory:
virtualenv clean-img-classification-dataset-env -
Activate the virtual environment:
- On Windows:
.\clean-img-classification-dataset-env\Scripts\activate - On Unix or MacOS:
source clean-img-classification-dataset-env/bin/activate
- On Windows:
-
Install the required dependencies:
pip3 install -r requirements.txt
- First ensure you have saved your embeddings, labels, and paths to a .npz file. You can insert the following code into your script where the embeddings, labels, and paths are generated.
import numpy as np embeddings = [] # list of embeddings labels = [] # list of labels image_paths = [] # list of img paths np.savez_compressed( "image_embeddings_labels_paths.npz", embeddings=np.vstack(embeddings), # Stack embeddings into a 2D array labels=np.array(labels), # Convert labels to a 1D numpy array image_paths=np.array(image_paths) # Convert image paths to a 1D numpy array ) - Update the
NPZ_PATHvariable inclean_dataset.pyto the path of your .npz file. - Run the script:
python3 clean_dataset.py