deeplearning4j / deeplearning4j

Suite of tools for deploying and training deep learning models using the JVM. Highlights include model import for keras, tensorflow, and onnx/pytorch, a modular and tiny c++ library for running math code and a java based math library on top of the core c++ library. Also includes samediff: a pytorch/tensorflow like library for running deep learn...
http://deeplearning4j.konduit.ai
Apache License 2.0
13.62k stars 3.82k forks source link

"org.bytedeco.javacv.FrameRecorder$Exception: No video output stream" while running ALE.java example #4749

Closed anis016 closed 6 years ago

anis016 commented 6 years ago

@saudet

Hello ! I am trying to run ALE.java in org.deeplearning4j.examples.rl4j package .. but, getting this error. Please check the gist !

https://gist.github.com/anis016/6e5a49cc40776a410bb15d7fa0d09bf4

Moreover, please share with me the correct ROM file for "pong.bin". Getting an warning given below.

Game console created: ROM file: pong.bin Cart Name: Video Olympics (1978) (Atari) Cart MD5: 60e0ea3cbe0913d39803477945e9e5ec Display Format: AUTO-DETECT ==> NTSC ROM Size: 2048 Bankswitch Type: AUTO-DETECT ==> 2K

WARNING: Possibly unsupported ROM: mismatched MD5. Cartridge_MD5: 60e0ea3cbe0913d39803477945e9e5ec Cartridge_name: Video Olympics (1978) (Atari)

saudet commented 6 years ago

That looks like the right bin. What do you get running the sample code on the following page? https://github.com/bytedeco/javacpp-presets/tree/master/ale#sample-usage

anis016 commented 6 years ago

I ran the sample code in the link, and this is working fine ! I can see the GUI window (ALE Viz) where the "pong" is played and also I could see the printing of the episodes...

====================================================================== A.L.E: Arcade Learning Environment (version 0.6.0) [Powered by Stella] Use -help for help screen. Warning: couldn't load settings file: ./ale.cfg Game console created: ROM file: /home/anis/Java_Workspace/SharedLibraryInterface/src/main/resources/pong.bin Cart Name: Video Olympics (1978) (Atari) Cart MD5: 60e0ea3cbe0913d39803477945e9e5ec Display Format: AUTO-DETECT ==> NTSC ROM Size: 2048 Bankswitch Type: AUTO-DETECT ==> 2K

Screen Display Active. [Manual Control Mode] 'm' [Slowdown] 'a' [Speedup] 's' [VolumeDown] '[' [VolumeUp] ']'.

WARNING: Possibly unsupported ROM: mismatched MD5. Cartridge_MD5: 60e0ea3cbe0913d39803477945e9e5ec Cartridge_name: Video Olympics (1978) (Atari)

Running ROM file... Random seed is 123 Episode 0 ended with score: -21.0 Episode 1 ended with score: -21.0 Episode 2 ended with score: -20.0 Episode 3 ended with score: -21.0 . .

saudet commented 6 years ago

Ok, good!

There's been a couple of things fixed since DL4J 0.9.1 though, so could you try with 0.9.2-SNAPSHOT and let me know if this still happens? Thanks!

anis016 commented 6 years ago

Hello @saudet ! It took a while to build everything from scratch...

  1. I built in this way for 0.9.2-SNAPSHOT: https://gist.github.com/anis016/0f9c759e57dd641cd18e67516475dbed

  2. I created a new module "rl4jexample" in the "rl4j" and copied the ALE.java in here. Pom: https://gist.github.com/anis016/f70e5a3e61d2c7ba38f72fe602d0957e

  3. The error: https://gist.github.com/anis016/81c216265526a7fea1f613741fdd2211

Please advise further !

saudet commented 6 years ago

Ah, you didn't have to build everything from scratch, binaries are available here: https://deeplearning4j.org/snapshots

In any case, thanks for the log! It makes it clear the issue is this:

[libx264 @ 0x7f2f09132580] [Eval @ 0x7f2f11e71bf0] Invalid chars '.0' at the end of expression '30.0'
[libx264 @ 0x7f2f09132580] Unable to parse option value "30.0"
[libx264 @ 0x7f2f09132580] Error setting option crf to value 30.0.
org.bytedeco.javacv.FrameRecorder$Exception: avcodec_open2() error -22: Could not open video codec.

Looks like an issue with JavaCV. I should be able to fix this today...

saudet commented 6 years ago

Actually, I'm unable to reproduce this issue. "crf" is a float value, and setting something like "10.5" works just fine on my machine. Could you try to run the following test and let me know what happens? https://github.com/bytedeco/javacv/blob/master/platform/src/test/java/org/bytedeco/javacv/FrameGrabberTest.java#L266

anis016 commented 6 years ago

Hello @saudet Sorry for the late reply. I am only able to run dl4j, when I have access to a faster PC. However,

  1. I am not able to run the Testcase you mentioned. I have added the screenshot. There's several symbols it can't find. Please check and advice. scree

  2. Previously you mentioned, "you didn't have to build everything from scratch, binaries are available here: https://deeplearning4j.org/snapshots" I was not able to figure it out properly to run the 0.9.2 snapshot. could you please share with me a pom file ? or maybe a small project where ALE.java is running ? as I actually need to run only "org.deeplearning4j.examples.rl4j" package "ALE.java" ! And, since, it has no problem in your machine, I guess somewhere I am doing a bit wrong.

Thank you

saudet commented 6 years ago

You can find a sample pom.xml file for 0.9.2-SNAPSHOT on this branch: https://github.com/deeplearning4j/dl4j-examples/tree/sa_snapshot

It looks like your IDE has trouble loading artifacts from the snapshot server though, that's why JavaCV isn't working there. You'll need to figure out why that is...

anis016 commented 6 years ago

hello @saudet

there's some update... now I am getting this error after trying in another PC... please have a look. we tried in the master branch.

12:55:18.204 [main] ERROR org.deeplearning4j.rl4j.learning.sync.SyncLearning - Training failed.
java.lang.RuntimeException: Non-existent compression algorithm requested: [FLOAT]
    at org.nd4j.linalg.compression.BasicNDArrayCompressor.decompressi(BasicNDArrayCompressor.java:250)
    at org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner.validateDataType(DefaultOpExecutioner.java:541)
    at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.exec(NativeOpExecutioner.java:680)
    at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.exec(NativeOpExecutioner.java:119)
    at org.nd4j.linalg.api.ndarray.BaseNDArray.assign(BaseNDArray.java:1274)
    at org.nd4j.linalg.api.ndarray.BaseNDArray.put(BaseNDArray.java:2297)
    at org.deeplearning4j.rl4j.learning.sync.qlearning.discrete.QLearningDiscrete.setTarget(QLearningDiscrete.java:200)
    at org.deeplearning4j.rl4j.learning.sync.qlearning.discrete.QLearningDiscrete.trainStep(QLearningDiscrete.java:162)
    at org.deeplearning4j.rl4j.learning.sync.qlearning.QLearning.trainEpoch(QLearning.java:93)
    at org.deeplearning4j.rl4j.learning.sync.SyncLearning.train(SyncLearning.java:38)
    at com.packt.JavaDL.ReinforcmentLearning.ALE.main(ALE.java:66)
java.lang.RuntimeException: Non-existent compression algorithm requested: [FLOAT]
    at org.nd4j.linalg.compression.BasicNDArrayCompressor.decompressi(BasicNDArrayCompressor.java:250)
    at org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner.validateDataType(DefaultOpExecutioner.java:541)
    at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.exec(NativeOpExecutioner.java:680)
    at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.exec(NativeOpExecutioner.java:119)
    at org.nd4j.linalg.api.ndarray.BaseNDArray.assign(BaseNDArray.java:1274)
    at org.nd4j.linalg.api.ndarray.BaseNDArray.put(BaseNDArray.java:2297)
    at org.deeplearning4j.rl4j.learning.sync.qlearning.discrete.QLearningDiscrete.setTarget(QLearningDiscrete.java:200)
    at org.deeplearning4j.rl4j.learning.sync.qlearning.discrete.QLearningDiscrete.trainStep(QLearningDiscrete.java:162)
    at org.deeplearning4j.rl4j.learning.sync.qlearning.QLearning.trainEpoch(QLearning.java:93)
    at org.deeplearning4j.rl4j.learning.sync.SyncLearning.train(SyncLearning.java:38)
    at com.packt.JavaDL.ReinforcmentLearning.ALE.main(ALE.java:66)

gist: https://gist.github.com/rezacsedu/46281a884179c17123516e8114e058cd

saudet commented 6 years ago

@raver119 I'm also getting that stack trace on my machine. Do you know what changed with respect to the compression algorithms?

raver119 commented 6 years ago

Nothing changed AFAIK, but i'm seeing the same issue in nd4j-tests, so i'm going to check & fix that once i'm done with cnn gradients problem.

saudet commented 6 years ago

ok, so it is an issue with compression, good to know!

saudet commented 6 years ago

Confirmed fixed, thanks to @raver119!

lock[bot] commented 6 years ago

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.