First, create a virtual environment using the requirements file:
python -m venv venvOn Windows:
venv\Scripts\activateOn macOS/Linux:
source venv/bin/activatepip install -r requirements.txt- Select the kernel in your Jupyter notebook
- Press Ctrl + Shift + P (or Cmd + Shift + P on macOS) to open the command palette
- Search for "Jupyter: Select Interpreter"
- Click on it and select the virtual environment you just created as the interpreter
- This will start the Jupyter server with the correct environment
Your dataset must be organized in the following structure:
datafolder/
├── train/
│ └── [image files]
├── test/
│ └── [image files]
└── val/ (optional)
└── [image files]
Additionally, you need CSV files with labels:
train.csv- Contains image filenames and their corresponding class labelstest.csv- Contains image filenames and their corresponding class labelsval.csv- (Optional) Contains image filenames and their corresponding class labels
CSV Format Example:
image_name,label
image1.jpg,class1
image2.jpg,class2Note: If your data is not in this format, you can create a Python script to reorganize your dataset into the required structure and generate the necessary CSV files.
For the YOLO demo, please check the dataset format restrictions and requirements in the link provided in the notebook. The notebook references the Ultralytics Object Detection Datasets Documentation for supported formats like YOLO and NDJSON.
Run cells in order: Make sure to execute each cell in the notebooks sequentially from top to bottom. Running cells out of order may result in undeclared or missing variable errors, as later cells depend on variables and functions defined in earlier cells.