Last active
January 26, 2020 20:40
-
-
Save AbdelmajidB/fccb871836746dd4f0d6e32828eadcdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyPathLabelGenerator implements PathLabelGenerator{ | |
protected static final Logger log = LoggerFactory.getLogger(MyPathLabelGenerator.class); | |
String labelsDir; | |
private static NativeImageLoader imageLoader = new NativeImageLoader(96, 96, 1); | |
File file; | |
public MyPathLabelGenerator(String path) { | |
labelsDir=path; | |
} | |
public Writable getLabelForPath(String path) { | |
// TODO Auto-generated method stub | |
String dirName; | |
file=new File(path); | |
if(path.contains("testI")) | |
dirName=labelsDir+"/testI/rois/"+file.getName(); | |
else | |
dirName=labelsDir+"/trainI/rois/"+file.getName(); | |
try | |
{ | |
INDArray origImg=imageLoader.asMatrix(new File(dirName)); | |
return new NDArrayWritable(origImg); | |
} | |
catch(IOException ioe) | |
{ | |
ioe.printStackTrace(); | |
return null; | |
} | |
} | |
public Writable getLabelForPath(URI uri) { | |
// TODO Auto-generated method stub | |
return null; | |
} | |
public boolean inferLabelClasses() { | |
// TODO Auto-generated method stub | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment