|
a |
|
b/README.md |
|
|
1 |
# Blood Cancer Detection with YOLOV5 |
|
|
2 |
|
|
|
3 |
# Intrudiction |
|
|
4 |
|
|
|
5 |
This notes that I took for target detection with yolov5. In this project, blood cancer cells were detected. |
|
|
6 |
|
|
|
7 |
<img src="https://github.com/safakgunes/Blood-Cancer-Detection-YOLOV5/blob/main/yolov5/runs/train/exp/val_batch1_pred.jpg?raw=true" alt="prediction" width="600"/> |
|
|
8 |
|
|
|
9 |
## Create an environment |
|
|
10 |
|
|
|
11 |
* Update pip with the following command. |
|
|
12 |
```bash |
|
|
13 |
$ python -m pip install --upgrade pip |
|
|
14 |
``` |
|
|
15 |
* Create an enviroment. |
|
|
16 |
```bash |
|
|
17 |
$ conda create --name yolov5 |
|
|
18 |
``` |
|
|
19 |
* Activate this environment |
|
|
20 |
```bash |
|
|
21 |
$ conda activate yolov5 |
|
|
22 |
``` |
|
|
23 |
## Requirements |
|
|
24 |
|
|
|
25 |
* Open the yolov5 directory |
|
|
26 |
```bash |
|
|
27 |
$ cd <yolov5_dir> |
|
|
28 |
``` |
|
|
29 |
* Setup requirements |
|
|
30 |
```bash |
|
|
31 |
$ pip install -r requirements.txt |
|
|
32 |
``` |
|
|
33 |
* Make sure you have cuda and cudnn installs |
|
|
34 |
|
|
|
35 |
## Train |
|
|
36 |
|
|
|
37 |
* Make sure environment activated. Go to yolov5 directory. |
|
|
38 |
```bash |
|
|
39 |
$ cd <yolov5_dir> |
|
|
40 |
``` |
|
|
41 |
|
|
|
42 |
* Run commands below |
|
|
43 |
```bash |
|
|
44 |
% python train.py --img 416 --data ../data.yaml --cfg ./models/yolov5s.yaml --batch 32 --epochs 50 |
|
|
45 |
``` |
|
|
46 |
* You can see the training results and weights, enter the directory below in the yolov5 folder. |
|
|
47 |
|
|
|
48 |
```bash |
|
|
49 |
$ cd <yolov5_dir>/runs/train |
|
|
50 |
``` |
|
|
51 |
## Detect |
|
|
52 |
|
|
|
53 |
* Run commands below |
|
|
54 |
|
|
|
55 |
```bash |
|
|
56 |
$ python detect.py --source ../dataset/test/images/ --weights ./runs/train/exp/weights/best.pt --conf 0.4 |
|
|
57 |
``` |
|
|
58 |
* You can see the detection results, enter the directory below in the yolov5 folder. |
|
|
59 |
|
|
|
60 |
```bash |
|
|
61 |
$ cd <yolov5_dir>/runs/detect |
|
|
62 |
``` |