Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Backwards Compatible FileSplit #6457

Closed
BarendHarris opened this issue Sep 18, 2018 · 3 comments · Fixed by #6470

Comments

@BarendHarris
Copy link

commented Sep 18, 2018

I am trying to develop an application that can train using images on an android phone, however the device has API level 22. The FileSplit implementation uses the .toPath() method and Path Object that was only introduced in Android API 26, so when creating a FileSplit the following error occurs. (At least I believe that to be the cause).

java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:304)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NoSuchMethodError: No virtual method toPath()Ljava/nio/file/Path; in class Ljava/io/File; or its super classes (declaration of 'java.io.File' appears in /system/framework/core-libart.jar)
        at org.datavec.api.split.FileSplit.initialize(FileSplit.java:108)
        at org.datavec.api.split.FileSplit.<init>(FileSplit.java:58)
        at org.datavec.api.split.FileSplit.<init>(FileSplit.java:74)

Would it possible to create an implementation of FileSplit that is backwards compatible with versions of Android < 26? If not, how would I go about creating an implementation that does support this?

Thanks

@AlexDBlack

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2018

In principle, sure - I think the only place this method is used is for recursively listing of files here:
https://github.com/deeplearning4j/deeplearning4j/blob/master/datavec/datavec-api/src/main/java/org/datavec/api/split/FileSplit.java#L108
https://github.com/deeplearning4j/deeplearning4j/blob/master/datavec/datavec-api/src/main/java/org/datavec/api/split/FileSplit.java#L229-L256

Changing this should be relatively straightforward - feel free to send us a pull request with a fix - or I'll try to take a look later in the week.

@BarendHarris

This comment has been minimized.

Copy link
Author

commented Sep 19, 2018

Thanks Alex,

I'm not sure I'd be able to fix this myself, so I would really appreciate it if you could take a look please.

AlexDBlack added a commit that referenced this issue Sep 20, 2018
AlexDBlack added a commit that referenced this issue Sep 23, 2018
DL4J/ND4J Misc fixes (#6470)
* #6431 SimpleRNN respect biasInit config value

* #6457 FileSplit android compatibility

* #6451 Improve preconditions class

* Fix pad op mapping

* #6471 Check for OutputLayer as first step in MultiLayerNetwork.computeGradientAndScore()

* Fix Reverse op mapping; map HistogramFixedWidth

* Fix HistogramfixedWidth mapping

* Fix DeConv2DTF op import mapping

* Fix unsorted op mapping

* HistogramFixedWidth fix; map DynamicPartitionBp

* Conv3d and OneHot test fixes

* More test fixes/re-enabling

* Restore ReverseV2 op

* Test tweaks
@lock

This comment has been minimized.

Copy link

commented Oct 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Oct 24, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.