Change default size for deeplearning4j-core

master
agibsonccc 2021-03-27 09:39:12 +09:00
parent 763b082f6a
commit 83cb1a2326
4 changed files with 22 additions and 2 deletions

View File

@ -57,14 +57,15 @@ public class NativeImageLoader extends BaseImageLoader {
"png", "tif", "tiff", "exr", "webp", "BMP", "GIF", "JPG", "JPEG", "JP2", "PBM", "PGM", "PPM", "PNM", "png", "tif", "tiff", "exr", "webp", "BMP", "GIF", "JPG", "JPEG", "JP2", "PBM", "PGM", "PPM", "PNM",
"PNG", "TIF", "TIFF", "EXR", "WEBP"}; "PNG", "TIF", "TIFF", "EXR", "WEBP"};
protected OpenCVFrameConverter.ToMat converter = new OpenCVFrameConverter.ToMat(); protected OpenCVFrameConverter.ToMat converter;
boolean direct = !Loader.getPlatform().startsWith("android"); boolean direct = !Loader.getPlatform().startsWith("android");
/** /**
* Loads images with no scaling or conversion. * Loads images with no scaling or conversion.
*/ */
public NativeImageLoader() {} public NativeImageLoader() {
}
/** /**
* Instantiate an image with the given * Instantiate an image with the given
@ -76,6 +77,7 @@ public class NativeImageLoader extends BaseImageLoader {
public NativeImageLoader(long height, long width) { public NativeImageLoader(long height, long width) {
this.height = height; this.height = height;
this.width = width; this.width = width;
converter = new OpenCVFrameConverter.ToMat();
} }
@ -90,6 +92,7 @@ public class NativeImageLoader extends BaseImageLoader {
this.height = height; this.height = height;
this.width = width; this.width = width;
this.channels = channels; this.channels = channels;
converter = new OpenCVFrameConverter.ToMat();
} }
/** /**
@ -103,6 +106,7 @@ public class NativeImageLoader extends BaseImageLoader {
public NativeImageLoader(long height, long width, long channels, boolean centerCropIfNeeded) { public NativeImageLoader(long height, long width, long channels, boolean centerCropIfNeeded) {
this(height, width, channels); this(height, width, channels);
this.centerCropIfNeeded = centerCropIfNeeded; this.centerCropIfNeeded = centerCropIfNeeded;
converter = new OpenCVFrameConverter.ToMat();
} }
/** /**
@ -116,6 +120,7 @@ public class NativeImageLoader extends BaseImageLoader {
public NativeImageLoader(long height, long width, long channels, ImageTransform imageTransform) { public NativeImageLoader(long height, long width, long channels, ImageTransform imageTransform) {
this(height, width, channels); this(height, width, channels);
this.imageTransform = imageTransform; this.imageTransform = imageTransform;
converter = new OpenCVFrameConverter.ToMat();
} }
/** /**
@ -129,6 +134,7 @@ public class NativeImageLoader extends BaseImageLoader {
public NativeImageLoader(long height, long width, long channels, MultiPageMode mode) { public NativeImageLoader(long height, long width, long channels, MultiPageMode mode) {
this(height, width, channels); this(height, width, channels);
this.multiPageMode = mode; this.multiPageMode = mode;
converter = new OpenCVFrameConverter.ToMat();
} }
protected NativeImageLoader(NativeImageLoader other) { protected NativeImageLoader(NativeImageLoader other) {
@ -138,6 +144,7 @@ public class NativeImageLoader extends BaseImageLoader {
this.centerCropIfNeeded = other.centerCropIfNeeded; this.centerCropIfNeeded = other.centerCropIfNeeded;
this.imageTransform = other.imageTransform; this.imageTransform = other.imageTransform;
this.multiPageMode = other.multiPageMode; this.multiPageMode = other.multiPageMode;
converter = new OpenCVFrameConverter.ToMat();
} }
@Override @Override

View File

@ -35,6 +35,8 @@ import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.nd4j.common.resources.Resources; import org.nd4j.common.resources.Resources;
import org.nd4j.common.tests.tags.NativeTag; import org.nd4j.common.tests.tags.NativeTag;
import org.nd4j.common.tests.tags.TagNames; import org.nd4j.common.tests.tags.TagNames;
@ -65,6 +67,8 @@ import static org.junit.jupiter.api.Assertions.fail;
@Slf4j @Slf4j
@NativeTag @NativeTag
@Tag(TagNames.FILE_IO) @Tag(TagNames.FILE_IO)
@Tag(TagNames.LARGE_RESOURCES)
@Tag(TagNames.LONG_TEST)
public class TestNativeImageLoader { public class TestNativeImageLoader {
static final long seed = 10; static final long seed = 10;
static final Random rng = new Random(seed); static final Random rng = new Random(seed);

View File

@ -33,6 +33,11 @@
<artifactId>deeplearning4j-core</artifactId> <artifactId>deeplearning4j-core</artifactId>
<properties>
<test.offheap.size>1g</test.offheap.size>
<test.heap.size>1g</test.heap.size>
</properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@ -43,6 +43,8 @@ import org.deeplearning4j.optimize.listeners.ScoreIterationListener;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.nd4j.common.tests.tags.NativeTag; import org.nd4j.common.tests.tags.NativeTag;
import org.nd4j.common.tests.tags.TagNames; import org.nd4j.common.tests.tags.TagNames;
import org.nd4j.linalg.activations.Activation; import org.nd4j.linalg.activations.Activation;
@ -62,6 +64,8 @@ import org.junit.jupiter.api.extension.ExtendWith;
@DisplayName("Data Set Iterator Test") @DisplayName("Data Set Iterator Test")
@Tag(TagNames.FILE_IO) @Tag(TagNames.FILE_IO)
@NativeTag @NativeTag
@Tag(TagNames.LARGE_RESOURCES)
@Tag(TagNames.LONG_TEST)
class DataSetIteratorTest extends BaseDL4JTest { class DataSetIteratorTest extends BaseDL4JTest {
@Override @Override