Skip to content

Commit e8cf5c3

Browse files
1.22版本更新 合并至 master (#9)
* 文档更新 * 更新其中的1.17版本官方文档 * 开始新版本1.18的开发 开始开发任务 * update * 新增矩阵 AGG 函数的逻辑实现 * update * 新增边框对象 * update * update * 完善模板匹配函数的实现,增加步长,提升效率。 * update * update * 矩阵开始被归一化计算组件支持 * Update Case.md * update * 针对图像矩阵进行了合并功能的更新 * 针对IO数据流进行了优化。 * update * 为AS库添加第三方数据源支持,并允许通过摄像头获取到图像数据 * update * update * update * 更新HDFS数据IO组件 * update * 1.18版本发布 * 1.18版本发布,新版本已发布至maven * update log * 更新日志中英文文档链接 * update * 格式化文档 * Update Case.md * Update Case.md * Create sourceMaterial.md * update * 更新1.18版本的文档 * 更新主页文档 * 1.18-1.19版本开发开始 * update * 新增 单例数据DF对象,其在存在大量重复数据的场景下,内存将节省很多倍。 * update * update * update * update * 支持目标外绝矩形,图像监督分类两种模型的计算。 * Update sourceMaterial.md * Update sourceMaterial.md * Update sourceMaterial.md * update * update * 更新数学模型类 * 新增线性神经网络训练模型 * 数据输入设备对象升级 * Input HDFS 支持针对矩阵的输入操作 * 线性神经网络支持进行训练时的附加Task。 * update * update * 1.19版本上传至maven * 更新1.19版本代码,准备合并分支 * update * Update sourceMaterial.md * update * 更新了单层卷积神经网络模型 * update * update * Update sourceMaterial.md * update * Update sourceMaterial.md * Update sourceMaterial.md * Update sourceMaterial.md * Update sourceMaterial.md * Update sourceMaterial.md * Update ASMath.java * update * 更新本地文件数据集加载器 * Update Share.java * update * 为所有的操作数对象添加不同维度形状的数据类型计算操作,例如其支持矩阵与向量或单个数值之间的计算操作。 * 为所有的操作数对象都提供了父类到子类的转换实现。 * 拓展灵活性 * 矩阵与矩阵空间操作数对象支持维度重设操作。 * 针对图像矩阵对象,新增了均值池化操作 * 图像矩阵新增均值池化与分通道均值池化的常量处理模块。 * 准备更新1.20版本 * 更新文档 * 矩阵灵活性提升,单例池灵活性提升 * 支持 fill 一个数值类型的矩阵对象 * 支持 clear 单例单元格数据存储池 * update * 1.20版本发布 * 新版本更新 * 更新新版本文档 * 1.21版本开始开发 * 1.21版本正式发布 * 修复所有在2023年06月10号前所有已知的bug。 * 1.21版本开始开发 * 新增图像矩阵对象 * 新增 哈希图像矩阵对象,其能够实现像素点的复用,降低内存占用。 * update * 更新API操作方式 * update * 针对 DF 数据类型进行了更加完善的优化。 * 1.22版本上传 * 针对1.21版本的一个优化版本与小更新。
1 parent a75c68e commit e8cf5c3

30 files changed

+3284
-881
lines changed

AsLib/libBeardedManZhao.dll

0 Bytes
Binary file not shown.

README-Chinese.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ AS库目录有多个版本,如果希望查询不同版本的更新日志以及
2323
<dependency>
2424
<groupId>io.github.BeardedManZhao</groupId>
2525
<artifactId>algorithmStar</artifactId>
26-
<version>1.20</version>
26+
<version>1.22</version>
2727
</dependency>
2828
</dependencies>
2929
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ can add it to your maven project, or you can download it from Releases and manua
2929
<dependency>
3030
<groupId>io.github.BeardedManZhao</groupId>
3131
<artifactId>algorithmStar</artifactId>
32-
<version>1.20</version>
32+
<version>1.22</version>
3333
</dependency>
3434
</dependencies>
3535
```

src_code/.idea/scala_compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src_code/README-Chinese.md

Lines changed: 194 additions & 444 deletions
Large diffs are not rendered by default.

src_code/README.md

Lines changed: 209 additions & 372 deletions
Large diffs are not rendered by default.

src_code/pom.xml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>io.github.BeardedManZhao</groupId>
77
<artifactId>algorithmStar</artifactId>
8-
<version>1.20</version>
8+
<version>1.22</version>
99
<packaging>jar</packaging>
1010
<name>algorithmStar</name>
1111
<description>algorithmStar-java</description>
@@ -33,6 +33,7 @@
3333

3434

3535
<dependencies>
36+
3637
<!-- 使用 log4j2 的适配器进行绑定 -->
3738
<dependency>
3839
<groupId>org.apache.logging.log4j</groupId>
@@ -57,17 +58,19 @@
5758
</dependency>
5859

5960
<dependency>
60-
<groupId>mysql</groupId>
61-
<artifactId>mysql-connector-java</artifactId>
62-
<version>8.0.32</version>
61+
<groupId>com.mysql</groupId>
62+
<artifactId>mysql-connector-j</artifactId>
63+
<version>8.0.33</version>
6364
<scope>provided</scope>
6465
</dependency>
66+
6567
<dependency>
6668
<groupId>org.apache.spark</groupId>
6769
<artifactId>spark-core_2.12</artifactId>
6870
<version>3.4.0</version>
6971
<scope>provided</scope>
7072
</dependency>
73+
7174
<dependency>
7275
<groupId>org.apache.spark</groupId>
7376
<artifactId>spark-sql_2.12</artifactId>
@@ -145,6 +148,34 @@
145148
<build>
146149
<!--发布到中央SNAPSHOT仓库插件-->
147150
<plugins>
151+
<!-- scala 编译插件 -->
152+
<plugin>
153+
<groupId>net.alchim31.maven</groupId>
154+
<artifactId>scala-maven-plugin</artifactId>
155+
<version>3.2.0</version>
156+
<executions>
157+
<execution>
158+
<id>compile-scala</id>
159+
<phase>process-resources</phase>
160+
<goals>
161+
<goal>add-source</goal>
162+
<goal>compile</goal>
163+
</goals>
164+
</execution>
165+
<execution>
166+
<id>scala-compile-first</id>
167+
<phase>compile</phase>
168+
<goals>
169+
<goal>add-source</goal>
170+
<goal>testCompile</goal>
171+
</goals>
172+
</execution>
173+
</executions>
174+
<configuration>
175+
<scalaVersion>2.12.14</scalaVersion>
176+
</configuration>
177+
</plugin>
178+
148179
<plugin>
149180
<groupId>org.sonatype.plugins</groupId>
150181
<artifactId>nexus-staging-maven-plugin</artifactId>

src_code/src/main/java/zhao/algorithmMagic/MAIN1.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
import java.io.File;
88

9-
109
public class MAIN1 {
11-
12-
// 在 main 函数中进行模型的保存和读取以及使用
1310
public static void main(String[] args) {
1411
System.out.println(OperationAlgorithmManager.VERSION);
1512
if (args.length > 0) {

src_code/src/main/java/zhao/algorithmMagic/algorithm/OperationAlgorithmManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
* @author LingYuZhao
1919
*/
2020
public final class OperationAlgorithmManager implements OperationAlgorithm {
21-
public final static float VERSION = 1.20f;
21+
/**
22+
* AS version
23+
*/
24+
public final static float VERSION = 1.22f;
25+
2226
/**
2327
* 计算组件的日志打印开关,当此处值为false的时候,计算组件中的日志将不会被打印,logger也不会被调用,一般来说,这里为了减少冗余的字符串实例化操作,会设置为false,当需要调试的时候才需要打开此处的数值。
2428
* <p>

src_code/src/main/java/zhao/algorithmMagic/core/model/dataSet/Share.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ public final class Share {
8888
/**
8989
* 获取到训练的时候使用的图像样本。
9090
*
91-
* @param w 获取图像的尺寸-宽
92-
* @param h 获取图像的尺寸-高
93-
* @param urls 需要被获取的所有图像对应的URL
91+
* @param w 获取图像的尺寸-宽。
92+
* @param h 获取图像的尺寸-高。
93+
* @param urls 需要被获取的所有图像对应的URL。
94+
* @return 经过处理之后返回的所有数据矩阵叠加成为的矩阵空间对象。
95+
* @throws MalformedURLException URL 格式错误会抛出此异常。
9496
*/
9597
public static IntegerMatrixSpace[] getData(int w, int h, String... urls) throws MalformedURLException {
9698
IntegerMatrixSpace[] integerMatrixSpaces = new IntegerMatrixSpace[urls.length];
@@ -108,6 +110,8 @@ public static IntegerMatrixSpace[] getData(int w, int h, String... urls) throws
108110
* @param w 获取图像的尺寸-宽
109111
* @param h 获取图像的尺寸-高
110112
* @param urls 需要被获取的所有图像对应的URL
113+
* @return 经过处理之后返回的所有数据矩阵叠加成为的矩阵空间对象。
114+
* @throws MalformedURLException URL 格式错误会抛出此异常。
111115
*/
112116
public static IntegerMatrixSpace[] getData(int w, int h, String[]... urls) throws MalformedURLException {
113117
IntegerMatrixSpace[] integerMatrixSpaces = new IntegerMatrixSpace[urls.length * urls[0].length];
@@ -124,8 +128,10 @@ public static IntegerMatrixSpace[] getData(int w, int h, String[]... urls) throw
124128
/**
125129
* 获取到权重数据样本
126130
*
127-
* @param w 获取图像的尺寸-宽
128-
* @param h 获取图像的尺寸-高
131+
* @param w 获取图像的尺寸-宽
132+
* @param h 获取图像的尺寸-高
133+
* @param nameAndUrl 所有图像的名称以及其对应的URL的list。
134+
* @return 经过处理之后返回的所有数据矩阵叠加成为的矩阵空间对象。
129135
* @throws MalformedURLException 从网络中提取数据的异常
130136
*/
131137
public static List<KeyValue<String, IntegerMatrixSpace>> getImageWeight(int w, int h, List<KeyValue<String, String>> nameAndUrl) throws MalformedURLException {

src_code/src/main/java/zhao/algorithmMagic/operands/ComplexNumber.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ protected ComplexNumber(double real, double imaginary, String expression) {
5151
this.expression = expression;
5252
}
5353

54+
/**
55+
* 使用实部数值与虚部数值进行复数对象的创建操作。
56+
* <p>
57+
* Create complex objects using real and imaginary values.
58+
*
59+
* @param real 实数部分的数值。
60+
* <p>
61+
* The numerical value of the real part.
62+
* @param imaginary 虚部的数值。
63+
* <p>
64+
* The numerical value of the imaginary part.
65+
* @return 由指定的实部数值与虚部数值解析出来的复数对象。
66+
* <p>
67+
* A complex object parsed from the specified real and imaginary values.
68+
*/
5469
public static ComplexNumber parse(double real, double imaginary) {
5570
return new ComplexNumber(real, imaginary);
5671
}
@@ -83,10 +98,28 @@ public static ComplexNumber parse(String s) {
8398
throw new OperatorOperationException("[" + s + "]似乎不是一个正确的复数形式哦!正确的复数形式应为:[a + bi] or [a - bi]");
8499
}
85100

101+
/**
102+
* 从对象中提取指定部分的数值。
103+
* <p>
104+
* Extract the specified part of the numerical value from the object.
105+
*
106+
* @return 提取出对象的是实部数值。
107+
* <p>
108+
* The extracted object is a real part value.
109+
*/
86110
public double getReal() {
87111
return real;
88112
}
89113

114+
/**
115+
* 从对象中提取指定部分的数值。
116+
* <p>
117+
* Extract the specified part of the numerical value from the object.
118+
*
119+
* @return 提取出对象的是实部数值。
120+
* <p>
121+
* The extracted object is imaginary value.
122+
*/
90123
public double getImaginary() {
91124
return imaginary;
92125
}

src_code/src/main/java/zhao/algorithmMagic/operands/matrix/ColorMatrix.java

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public static ColorMatrix parse(Color[]... ints) {
480480
* The matrix object obtained from the image.
481481
*/
482482
public static ColorMatrix parse(String inputString, int... v) {
483-
return ColorMatrix.parse(ASIO.parseImageGetColorArray(inputString, v));
483+
return parse(ASIO.parseImageGetColorArray(inputString, v));
484484
}
485485

486486
/**
@@ -497,7 +497,7 @@ public static ColorMatrix parse(String inputString, int... v) {
497497
*/
498498
public static ColorMatrix parseGrayscale(String inputString) {
499499
Color[][] colors = ASIO.parseImageGetColorArray(inputString);
500-
return ColorMatrix.GrayscaleColors(colors);
500+
return GrayscaleColors(colors);
501501
}
502502

503503
/**
@@ -534,7 +534,7 @@ public static ColorMatrix parse(IntegerMatrixSpace integerMatrixSpace) {
534534
}
535535
}
536536
}
537-
return ColorMatrix.parse(colors);
537+
return parse(colors);
538538
}
539539

540540
/**
@@ -563,15 +563,15 @@ public static ColorMatrix parse(IntegerMatrix integerMatrix, boolean isGrayscale
563563
row[i] = new Color(anInt, anInt, anInt);
564564
}
565565
}
566-
return ColorMatrix.parse(colors);
566+
return parse(colors);
567567
}
568568
for (int[] ints : integerMatrix.toArrays()) {
569569
Color[] row = colors[++y];
570570
for (int i = 0; i < ints.length; i++) {
571571
row[i] = new Color(ints[i]);
572572
}
573573
}
574-
return ColorMatrix.parse(colors);
574+
return parse(colors);
575575
}
576576

577577
/**
@@ -584,7 +584,7 @@ public static ColorMatrix parse(IntegerMatrix integerMatrix, boolean isGrayscale
584584
* @return URL对象所对应的图像矩阵。
585585
*/
586586
public static ColorMatrix parse(URL url, int... v) {
587-
return ColorMatrix.parse(ASIO.parseURLGetColorArray(url, v));
587+
return parse(ASIO.parseURLGetColorArray(url, v));
588588
}
589589

590590

@@ -595,7 +595,7 @@ public static ColorMatrix parse(URL url, int... v) {
595595
* @return URL对象所对应的图像矩阵。
596596
*/
597597
public static ColorMatrix parseGrayscale(URL url) {
598-
return ColorMatrix.GrayscaleColors(ASIO.parseURLGetColorArray(url));
598+
return GrayscaleColors(ASIO.parseURLGetColorArray(url));
599599
}
600600

601601
/**
@@ -626,7 +626,7 @@ public static ColorMatrix parse(InputComponent inputComponent, boolean isOC) {
626626
}
627627
if (isOk) {
628628
// 开始进行数据提取
629-
ColorMatrix parse = ColorMatrix.parse(ASIO.parseImageGetColorArray(inputComponent.getBufferedImage()));
629+
ColorMatrix parse = parse(ASIO.parseImageGetColorArray(inputComponent.getBufferedImage()));
630630
if (isOC) ASIO.close(inputComponent);
631631
return parse;
632632
} else throw new OperatorOperationException("Unable to open your inputComponent.");
@@ -663,7 +663,7 @@ public static ColorMatrix random(int width, int height, int randSeed) {
663663
* @param colors 需要被转换的颜色矩阵(注意,该矩阵将会被修改)
664664
* @return 转换之后的颜色矩阵
665665
*/
666-
private static ColorMatrix GrayscaleColors(Color[][] colors) {
666+
protected static ColorMatrix GrayscaleColors(Color[][] colors) {
667667
for (Color[] color : colors) {
668668
int count = -1;
669669
for (Color color1 : color) {
@@ -726,6 +726,21 @@ public static Consumer<BufferedWriter> getSAVE_ASCII(ColorMatrix colorMatrix, by
726726
};
727727
}
728728

729+
/**
730+
* 使用克隆的方式创建出一个新的矩阵对象。
731+
*
732+
* @param colorMatrix 需要被克隆的原矩阵对象。
733+
* @param isCopy 克隆操作中的元素是否使用深拷贝
734+
* @return 克隆操作成功之后的新矩阵对象。
735+
*/
736+
public ColorMatrix clone(ColorMatrix colorMatrix, boolean isCopy) {
737+
return new ColorMatrix(
738+
colorMatrix.getColCount(), colorMatrix.getRowCount(),
739+
isCopy ? colorMatrix.copyToNewArrays() : colorMatrix.toArrays(),
740+
colorMatrix.isGrayscale
741+
);
742+
}
743+
729744
/**
730745
* 将两个操作数进行求和的方法,具体用法请参阅API说明。
731746
* <p>
@@ -909,6 +924,25 @@ public Color get(int row, int col) {
909924
return toArrays()[row][col];
910925
}
911926

927+
/**
928+
* 将指定的像素设置到指定的坐标上。
929+
* <p>
930+
* Set the specified pixel to the specified coordinates.
931+
*
932+
* @param row 纵坐标 代表的是 行索引。
933+
* <p>
934+
* The vertical axis represents the row index.
935+
* @param col 横坐标 代表的是 列索引。
936+
* <p>
937+
* The horizontal axis represents the column index.
938+
* @param color 当前坐标上要覆盖的新颜色对象。
939+
* <p>
940+
* The new color object to be overlaid on the current coordinate.
941+
*/
942+
public void set(int row, int col, Color color) {
943+
this.toArrays()[row][col] = color;
944+
}
945+
912946
/**
913947
* 将现有矩阵的转置矩阵获取到
914948
* <p>
@@ -2336,10 +2370,14 @@ public final void show(String title, int width, int height) {
23362370

23372371
/**
23382372
* 将当前图像矩阵中的图像绘制到 image 对象中。
2373+
* <p>
2374+
* Draw the image from the current image matrix into the image object.
23392375
*
23402376
* @param image 需要被绘制的图像对象。
2377+
* <p>
2378+
* The image object that needs to be drawn.
23412379
*/
2342-
public final void drawToImage(Image image) {
2380+
public void drawToImage(Image image) {
23432381
Graphics graphics = image.getGraphics();
23442382
// 开始绘制图形
23452383
int yc = -1;

src_code/src/main/java/zhao/algorithmMagic/operands/matrix/DoubleMatrix.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public static DoubleMatrix sparse(double[]... ints) {
9797
int rowMax = Integer.MIN_VALUE;
9898
int colMax = Integer.MIN_VALUE;
9999
for (double[] anInt : ints) {
100-
int rowNum = (int) anInt[2];
101-
int colNum = (int) anInt[1];
100+
int rowNum = (int) anInt[1];
101+
int colNum = (int) anInt[2];
102102
// 获取最大横坐标
103103
if (rowMax < rowNum) rowMax = rowNum;
104104
// 获取最大列坐标
@@ -834,7 +834,7 @@ public DoubleMatrix extractMat(int x1, int y1, int x2, int y2) {
834834
double[][] srcImage = this.toArrays();
835835
for (double[] color : colors) {
836836
double[] row = srcImage[y1++];
837-
if (color.length - x1 >= 0) System.arraycopy(row, x1, color, x1, color.length - x1);
837+
if (color.length - x1 >= 0) System.arraycopy(row, x1, color, 0, color.length - x1);
838838
}
839839
return DoubleMatrix.parse(colors);
840840
}

0 commit comments

Comments
 (0)