org.bigml.mimir.image.SkewedCenteringReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mimir Show documentation
Show all versions of mimir Show documentation
Java/Clojure Prediction Code for BigML
package org.bigml.mimir.image;
import java.io.Serializable;
import org.bigml.mimir.deepnet.network.ImageNetworkMetadata;
/**
* Image preprocessing specific to mobilenetv2, which normalizes pixels from -1
* to a number slightly less than 1.
*
* @author [email protected]
*
*/
public class SkewedCenteringReader extends ImageReader implements Serializable {
public SkewedCenteringReader() {}
public SkewedCenteringReader(int[] shape) {
super(shape);
}
public SkewedCenteringReader(int maxPixels) {
super(maxPixels);
}
public SkewedCenteringReader(ImageNetworkMetadata metadata) {
super(metadata);
}
@Override
protected double convert(double value, int depth) {
return (value / 128) - 1.;
}
private static final long serialVersionUID = 1L;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy