private void LoadBoundingBox(string file) { _imgAnnotateBoundingBoxList.Clear(); pbImage.Controls.Clear(); var width = _image.Width; var height = _image.Height; if (!File.Exists(file)) { return; } var list = IoUtils.File2List(file); foreach (var boxInfo in list) { var arr = boxInfo.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); var classId = arr[0].ToInt(); var centerX = (arr[1].ToDouble() * width).ToRoundInt(); var centerY = (arr[2].ToDouble() * height).ToRoundInt(); var boxWidth = (arr[3].ToDouble() * width).ToRoundInt(); var boxHeight = (arr[4].ToDouble() * height).ToRoundInt(); var left = centerX - boxWidth / 2; var top = centerY - boxHeight / 2; var dr = new DragableRectangle() { Parent = pbImage, Left = left, Top = top, Width = boxWidth, Height = boxHeight, ClassId = classId }; dr.OnRectDoubleClick += Dr_OnRectDoubleClick; _imgAnnotateBoundingBoxList.Add(dr); } }
private void btnConfirm_Click(object sender, EventArgs e) { var list = lbNames.Items.Cast <string>().Select(v => v.ToString()).ToList(); IoUtils.List2File(YOLOv3Files.ClassesNameFile, list); DialogResult = DialogResult.OK; }
public FrmSetBoundingClassId() { InitializeComponent(); var list = IoUtils.File2List(YOLOv3Files.ClassesNameFile); cmbClassesName.Items.Clear(); list.ForEach(n => cmbClassesName.Items.Add(n)); }
private void LoadNames() { var fileName = YOLOv3Files.ClassesNameFile; if (!File.Exists(fileName)) { return; } var list = IoUtils.File2List(fileName); foreach (var v in list) { lbNames.Items.Add(v); } }
private void btnGenDarknetDataFile_Click(object sender, EventArgs e) { var nameList = IoUtils.File2List(YOLOv3Files.ClassesNameFile); var dataList = new List <string>(); dataList.Add($"classes = {nameList.Count}"); dataList.Add($"train = {tbYOLOv3Detector.Text}/{Path.GetFileName(YOLOv3Files.TrainSampleFile)}"); dataList.Add($"valid = {tbYOLOv3Detector.Text}/{Path.GetFileName(YOLOv3Files.TestSampleFile)}"); dataList.Add($"names = {tbYOLOv3Detector.Text}/{Path.GetFileName(YOLOv3Files.ClassesNameFile)}"); dataList.Add($"backup = {tbYOLOv3Detector.Text}/"); var backupPath = Path.Combine(Application.StartupPath, tbYOLOv3Detector.Text); if (!Directory.Exists(backupPath)) { Directory.CreateDirectory(backupPath); } IoUtils.List2File(YOLOv3Files.DarknetDataFile, dataList); }
private void btnSpliteSample_Click(object sender, EventArgs e) { var rate = tbTestRate.Text.ToInt() / 100.0; var imgList = Directory.GetFiles(YOLOv3Files.ImagesPath, "*.jpg").Select(f => Path.GetFileName(f)).ToList(); var testCnt = (imgList.Count * rate).ToInt(); Random rmd = new Random(); var testImgList = new List <string>(); for (var i = 0; i < testCnt; i++) { var randomIndex = rmd.Next(imgList.Count); testImgList.Add(imgList[randomIndex]); imgList.RemoveAt(randomIndex); } testImgList = testImgList.Select(f => $".\\{tbYOLOv3Detector.Text}\\images\\{f}").ToList(); imgList = imgList.Select(f => $".\\{tbYOLOv3Detector.Text}\\images\\{f}").ToList(); IoUtils.List2File(YOLOv3Files.TrainSampleFile, imgList); IoUtils.List2File(YOLOv3Files.TestSampleFile, testImgList); }
private void btnSaveAnnotate_Click(object sender, EventArgs e) { var labelFile = Path.Combine(YOLOv3Files.ImagesPath, _labelFile); var width = _image.Width; var height = _image.Height; var list = new List <string>(); for (int i = 0; i < _imgAnnotateBoundingBoxList.Count; i++) { var box = _imgAnnotateBoundingBoxList[i]; var centerX = (box.Left + box.Width / 2) * 1.0 / width; var centerY = (box.Top + box.Height / 2) * 1.0 / height; var boxW = box.Width * 1.0 / width; var boxH = box.Height * 1.0 / height; var label = $"{box.ClassId} {centerX} {centerY} {boxW} {boxH}"; list.Add(label); } IoUtils.List2File(labelFile, list); }
private void btnGenCfgFile_Click(object sender, EventArgs e) { var nameList = IoUtils.File2List(YOLOv3Files.ClassesNameFile); var classesCnt = nameList.Count; _cfgList.Clear(); tbLog.Clear(); #region 生成配置内容 AppendCfg(""); AppendCfg("[net]"); AppendCfg("# Testing"); AppendCfg("#batch=1"); AppendCfg("#subdivisions=1"); AppendCfg("# Training"); AppendCfg("batch=32"); AppendCfg("subdivisions=32"); AppendCfg("width=416"); AppendCfg("height=416"); AppendCfg("channels=3"); AppendCfg("momentum=0.9"); AppendCfg("decay=0.0005"); AppendCfg("angle=0"); AppendCfg("saturation = 1.5"); AppendCfg("exposure = 1.5"); AppendCfg("hue=.1"); AppendCfg(""); AppendCfg("learning_rate=0.001"); AppendCfg("burn_in=1000"); var maxBatches = Math.Max(classesCnt * 2000, 5000); AppendCfg($"max_batches = {maxBatches}"); AppendCfg("policy=steps"); AppendCfg($"steps={(maxBatches * 0.8).ToInt()},{(maxBatches * 0.9).ToInt()}"); AppendCfg("scales=.1,.1"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=32"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("# Downsample"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=64"); AppendCfg("size=3"); AppendCfg("stride=2"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=32"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=64"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("# Downsample"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=3"); AppendCfg("stride=2"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=64"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=64"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("# Downsample"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=2"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("# Downsample"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=2"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation="); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("# Downsample"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=1024"); AppendCfg("size=3"); AppendCfg("stride=2"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=1024"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=1024"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=1024"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=1024"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[shortcut]"); AppendCfg("from=-3"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg("######################"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=1024"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=1024"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=512"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=1024"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg($"filters={(classesCnt + 5) * 3}"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[yolo]"); AppendCfg("mask = 6,7,8"); AppendCfg("anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326"); AppendCfg($"classes={classesCnt}"); AppendCfg("num=9"); AppendCfg("jitter=.3"); AppendCfg("ignore_thresh = .7"); AppendCfg("truth_thresh = 1"); AppendCfg("random=1"); AppendCfg(""); AppendCfg(""); AppendCfg("[route]"); AppendCfg("layers = -4"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[upsample]"); AppendCfg("stride=2"); AppendCfg(""); AppendCfg("[route]"); AppendCfg("layers = -1, 61"); AppendCfg(""); AppendCfg(""); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=512"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=512"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=256"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=512"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg($"filters={(classesCnt + 5) * 3}"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[yolo]"); AppendCfg("mask = 3,4,5"); AppendCfg("anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326"); AppendCfg($"classes={classesCnt}"); AppendCfg("num=9"); AppendCfg("jitter=.3"); AppendCfg("ignore_thresh = .7"); AppendCfg("truth_thresh = 1"); AppendCfg("random=1"); AppendCfg(""); AppendCfg(""); AppendCfg(""); AppendCfg("[route]"); AppendCfg("layers = -4"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[upsample]"); AppendCfg("stride=2"); AppendCfg(""); AppendCfg("[route]"); AppendCfg("layers = -1, 36"); AppendCfg(""); AppendCfg(""); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=256"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=256"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("filters=128"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("batch_normalize=1"); AppendCfg("size=3"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg("filters=256"); AppendCfg("activation=leaky"); AppendCfg(""); AppendCfg("[convolutional]"); AppendCfg("size=1"); AppendCfg("stride=1"); AppendCfg("pad=1"); AppendCfg($"filters={(classesCnt + 5) * 3}"); AppendCfg("activation=linear"); AppendCfg(""); AppendCfg(""); AppendCfg("[yolo]"); AppendCfg("mask = 0,1,2"); AppendCfg("anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326"); AppendCfg($"classes={classesCnt}"); AppendCfg("num=9"); AppendCfg("jitter=.3"); AppendCfg("ignore_thresh = .7"); AppendCfg("truth_thresh = 1"); AppendCfg("random=1"); #endregion IoUtils.List2File(YOLOv3Files.ConfigFile, _cfgList); }