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