-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grayscale v7 #6
base: master
Are you sure you want to change the base?
Grayscale v7 #6
Changes from all commits
1ac56a2
8391372
9020f08
cd1f194
90bca07
77565be
76b3cde
e96a537
96433ed
2bac69b
ee27bb4
0cdf7a2
3b2767a
c979d03
e239d38
54c346e
fdab5e2
98cb6fb
0eaf38a
6544d52
ae6a0a7
49ab6fe
ddb5104
9e38289
c22b8b2
a833598
5c10af8
0e3b271
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4fbd6fa3-a31c-4ba1-a917-6669fafcd904", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"!python -m torch.distributed.launch --nproc_per_node 2 train.py --img <img size> --batch <number of batches> --epochs <number of epochs> --data <yaml with labels path> --hyp data/hyps/hyp.scratch-low.yaml --weights yolov5m --cache --device 0,1 --name <experiment name>" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,7 @@ def _apply(self, fn): | |
|
||
class DetectionModel(BaseModel): | ||
# YOLOv5 detection model | ||
def __init__(self, cfg='yolov5s.yaml', ch=3, nc=None, anchors=None): # model, input channels, number of classes | ||
def __init__(self, cfg='yolov5s.yaml', ch=1, nc=None, anchors=None): # model, input channels, number of classes | ||
super().__init__() | ||
if isinstance(cfg, dict): | ||
self.yaml = cfg # model dict | ||
|
@@ -188,6 +188,9 @@ def __init__(self, cfg='yolov5s.yaml', ch=3, nc=None, anchors=None): # model, i | |
|
||
# Build strides, anchors | ||
m = self.model[-1] # Detect() | ||
|
||
ch = 1 | ||
|
||
if isinstance(m, (Detect, Segment)): | ||
s = 256 # 2x min stride | ||
m.inplace = self.inplace | ||
|
@@ -298,11 +301,13 @@ def _from_yaml(self, cfg): | |
|
||
def parse_model(d, ch): # model_dict, input_channels(3) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. input_channels(3) -> 1 |
||
# Parse a YOLOv5 model.yaml dictionary | ||
ch = [1] #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove comment (maybe use passed value instead of overriding it) |
||
LOGGER.info(f"\n{'':>3}{'from':>18}{'n':>3}{'params':>10} {'module':<40}{'arguments':<30}") | ||
anchors, nc, gd, gw, act = d['anchors'], d['nc'], d['depth_multiple'], d['width_multiple'], d.get('activation') | ||
if act: | ||
Conv.default_act = eval(act) # redefine default activation, i.e. Conv.default_act = nn.SiLU() | ||
LOGGER.info(f"{colorstr('activation:')} {act}") # print | ||
|
||
na = (len(anchors[0]) // 2) if isinstance(anchors, list) else anchors # number of anchors | ||
no = na * (nc + 5) # number of outputs = anchors * (classes + 5) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,4 @@ head: | |
|
||
[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5) | ||
] | ||
ch: 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add to other yamls if required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why override anyway here ?