using System;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.IO;
class Read
{
public static void Main(string[] args)
{
string pattern1 = @"\d(\s|$)"; //标签
string pattern2 = @"[0-9]\d{5}.jpg"; //路径
string pattern3 = @"\d+\,\d+\,\d+\,\d+"; //坐标
string pattern4 = @"\d+"; //坐标提取
List<int> labels = new List<int> { };
List<string> path1 = new List<string> { };
int[] box1 = new int[4];
int[] label1 = { };
List<box> boxes = new List<box> { };
List<Sample> samples = new List<Sample> { };
string path = @"C:\Users\Administrator\Desktop\1.txt"; //小样本试验
string[] contents = File.ReadAllLines(path);
foreach (string str in contents)
{
Sample sample = new Sample();
foreach (Match match1 in Regex.Matches(str, pattern1))
{
//Console.Write(Convert.ToInt32(match1.Value) + " ");
labels.Add(Convert.ToInt32(match1.Value));
//labels.Add(Convert.ToInt32(match1.Value));
}
sample.getLabels(labels);
foreach (Mat
c#练习——读取路径内容放入队列
最新推荐文章于 2022-08-21 18:56:20 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)