Rename
editorconfig
This commit is contained in:
@ -12,7 +12,7 @@ internal sealed class CnnFaceDetectionModelV1
|
||||
public static IEnumerable<MModRect> Detect(LossMmod net, Image image, int upsampleNumTimes)
|
||||
{
|
||||
using PyramidDown? pyr = new(2);
|
||||
List<MModRect>? rects = new();
|
||||
List<MModRect>? rects = [];
|
||||
|
||||
// Copy the data into dlib based objects
|
||||
using Matrix<RgbPixel>? matrix = new();
|
||||
@ -52,8 +52,8 @@ internal sealed class CnnFaceDetectionModelV1
|
||||
|
||||
public static IEnumerable<IEnumerable<MModRect>> DetectMulti(LossMmod net, IEnumerable<Image> images, int upsampleNumTimes, int batchSize = 128)
|
||||
{
|
||||
List<Matrix<RgbPixel>>? destImages = new();
|
||||
List<IEnumerable<MModRect>>? allRects = new();
|
||||
List<Matrix<RgbPixel>>? destImages = [];
|
||||
List<IEnumerable<MModRect>>? allRects = [];
|
||||
|
||||
try
|
||||
{
|
||||
@ -86,7 +86,7 @@ internal sealed class CnnFaceDetectionModelV1
|
||||
OutputLabels<IEnumerable<MModRect>>? dets = net.Operator(destImages, (ulong)batchSize);
|
||||
foreach (IEnumerable<MModRect>? det in dets)
|
||||
{
|
||||
List<MModRect>? rects = new();
|
||||
List<MModRect>? rects = [];
|
||||
foreach (MModRect? d in det)
|
||||
{
|
||||
DRectangle drect = pyr.RectDown(new DRectangle(d.Rect), (uint)upsampleNumTimes);
|
||||
|
@ -10,14 +10,14 @@ internal sealed class FaceRecognitionModelV1
|
||||
|
||||
public static Matrix<double> ComputeFaceDescriptor(LossMetric net, Image img, FullObjectDetection face, int numberOfJitters)
|
||||
{
|
||||
FullObjectDetection[]? faces = new[] { face };
|
||||
FullObjectDetection[]? faces = [face];
|
||||
return ComputeFaceDescriptors(net, img, faces, numberOfJitters).First();
|
||||
}
|
||||
|
||||
public static IEnumerable<Matrix<double>> ComputeFaceDescriptors(LossMetric net, Image img, IEnumerable<FullObjectDetection> faces, int numberOfJitters)
|
||||
{
|
||||
Image[]? batchImage = new[] { img };
|
||||
IEnumerable<FullObjectDetection>[]? batchFaces = new[] { faces };
|
||||
Image[]? batchImage = [img];
|
||||
IEnumerable<FullObjectDetection>[]? batchFaces = [faces];
|
||||
return BatchComputeFaceDescriptors(net, batchImage, batchFaces, numberOfJitters).First();
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ internal sealed class FaceRecognitionModelV1
|
||||
}
|
||||
|
||||
List<Array<Matrix<RgbPixel>>>? faceChipsArray = new(batchImages.Count);
|
||||
List<Matrix<RgbPixel>>? faceChips = new();
|
||||
List<Matrix<RgbPixel>>? faceChips = [];
|
||||
for (int i = 0; i < batchImages.Count; ++i)
|
||||
{
|
||||
IEnumerable<FullObjectDetection>? faces = batchFaces[i];
|
||||
@ -56,9 +56,9 @@ internal sealed class FaceRecognitionModelV1
|
||||
det.Dispose();
|
||||
}
|
||||
|
||||
List<List<Matrix<double>>>? faceDescriptors = new();
|
||||
List<List<Matrix<double>>>? faceDescriptors = [];
|
||||
for (int i = 0, count = batchImages.Count; i < count; i++)
|
||||
faceDescriptors.Add(new List<Matrix<double>>());
|
||||
faceDescriptors.Add([]);
|
||||
|
||||
if (numberOfJitters <= 1)
|
||||
{
|
||||
@ -115,7 +115,7 @@ internal sealed class FaceRecognitionModelV1
|
||||
|
||||
private static IEnumerable<Matrix<RgbPixel>> JitterImage(Matrix<RgbPixel> img, int numberOfJitters)
|
||||
{
|
||||
List<Matrix<RgbPixel>>? crops = new();
|
||||
List<Matrix<RgbPixel>>? crops = [];
|
||||
for (int i = 0; i < numberOfJitters; ++i)
|
||||
crops.Add(DlibDotNet.Dlib.JitterImage(img, _Rand));
|
||||
|
||||
|
@ -15,7 +15,7 @@ internal sealed class SimpleObjectDetector
|
||||
List<double> detectionConfidences,
|
||||
List<ulong> weightIndices)
|
||||
{
|
||||
List<Rectangle>? rectangles = new();
|
||||
List<Rectangle>? rectangles = [];
|
||||
|
||||
if (img.Mode == Mode.Greyscale)
|
||||
{
|
||||
@ -127,8 +127,8 @@ internal sealed class SimpleObjectDetector
|
||||
detector.ThrowIfDisposed();
|
||||
image.ThrowIfDisposed();
|
||||
|
||||
List<double>? detectionConfidences = new();
|
||||
List<ulong>? weightIndices = new();
|
||||
List<double>? detectionConfidences = [];
|
||||
List<ulong>? weightIndices = [];
|
||||
const double adjustThreshold = 0.0;
|
||||
|
||||
Rectangle[]? rects = RunDetectorWithUpscale1(detector,
|
||||
|
Reference in New Issue
Block a user