Ahoy guys
Regarding Deeplearning4j / Nixie / Jetson TX2
Is is "just" Openblas and libnd4j that needs to compile on the tx2 (arm64 / aarch64 / CUDA version: release 9.0 V9.0.252), or is it more to it than that ?
Current error:
[ERROR] Failed to execute goal on project mrl: Could not resolve dependencies for project org.myrobotlab:mrl:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.bytedeco.javacpp-presets:ffmpeg:jar:linux-aarch64:2.8.1-1.1, org.nd4j:nd4j-native:jar:linux-aarch64:1.0.0-alpha, org.bytedeco.javacpp-presets:openblas:jar:linux-aarch64:0.2.20-1.4.1, jdk.tools:jdk.tools:jar:1.8: Failure to find org.bytedeco.javacpp-presets:ffmpeg:jar:linux-aarch64:2.8.1-1.1 in https://repo.maven.apache.org/maven2was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
I compiled TensorFlow and that whent ok, but i understand it wil take some work from you gurus to
implement it to Nixie, and there is probaly more urgen matters than this...
For anyone else looking for info on Nixie / TensorFlow progress:
https://github.com/MyRobotLab/myrobotlab/issues/209
Last question, i would be nice just to test out Nixie a bit on the TX2, is there some way in Maven to "disable"
the bits that dosent currently compile so i could compile a Nixie jar without them?
And if there is anything i can do to help, please let me know
JavaCPP presets
Hi Spawn32.. Awesome that you're able to build libnd4j, that's a big step.
It sounds like you're on the right path. Reality is though, you also need the javacpp-presets with compilation for openblas, and ffmpeg.
https://github.com/bytedeco/javacpp-presets
Also., when you check out the source code, make sure you check out the tag/branch for the specific release that you're trying to build. For example. if you want to build Deeplearning4j, it's the 1.0.0-alpha release. If you compile it from "master" you'll end up with the wrong version to satisfy the dependencies.
Of note, there's a slightly newer version of deeplearning4j that's out 1.0.0-beta. We're still linking and depending on the 1.0.0-alpha branch.. We'll probably wait for the official 1.0 release to come out before upgrading MRL again.
So to build Deeplearning4j for version 1.0.0-alpha you'll specifically want to check out the following branch/commit:
https://github.com/deeplearning4j/deeplearning4j/tree/70e63018a65ae4a18…
That was the commit where the version number was bumped to 1.0.0-alpha
Follow Up question ;)
So had a go at OpenCV
So had a go at OpenCV tonight:
@kwatters and @ GroG, it made it to 92% compiled / linked and failed on boostdesc.cpp, this might just be a cmake problem or a file it coulden't download, will fix that tomorrow hopefully.. what i did was to copy paste the linux-arm64 section in cppbuild.sh and renamed the second one to linux-aarch64, they are very similar but i need to go over the compiler directives to be 100% sure,
Do any of you know about a javacpp project that has aarch64 support, would be the easyest way to checking them..
almoste workey ;)
@kwatters, got the OpenCV
@kwatters, got the OpenCV thingy compiled :)
But since there are other parts of nixie that dosent compile on the tx2 yet, could you be so nice and surgicaly inject the neede file from my onedrive linke here, and compile me a nixie jar ? pretty please :)
https://1drv.ms/u/s!Asf9doI7WS5djfYkTysFXAKvJt412A
included the 4 jar files it buildt , not sure witch of them you need...
renamed the jar
I can compile the opencv with and without cuda now, without cuda
jniopencv_core is key
When you built the opencv-linux-aarch64.jar file and added it to the libraries/jar folder, did the jniopencv_core link error go away? It should have..
That's the key one, I'm pretty sure the opencv_cudev stuff is just cuda related, and I think for the purposes of this task you should get native cpu working first. Keep it simple. Then once that's working, try to enable the cuda support. (which seems difficult due to the TX2 requiring Cuda9.2 where as OpenCV is still with Cuda9.1)
The goal here is to get it to work at all on the aarch64 arcitecture.
opencv_bigguns
@Kwatters, @Grog
Did a test on my windows machine, deleted the opencv x86_64 file and go the exact same jniopencv_core link error as expexcted.
Then copyed it back and renamed it to opencv_bigguns, and guess what it worked again :/ ,so mrl doesn pic the arcitecture from the file name, it scans for something inside all opencv jar's util if finds a match and i have no clue what it could be.... ????
Or acctaly, it can look like it scans all availibal jar's in libraries until it finds a match..
filename matters not
Spawn32, you're absolutely right, the file name has absolutely nothing to do with MRL finding the library. You can name the file foo.jar if you like. It doesn't matter.
The important thing is that the library that is contained within the jar is there and valid for your platform...
All the jar files in the libraries/jar are in the classpath. That means, so long as the jar file is in that directory, the JVM can find it.
Ok.. so now the question is, why is the jniopencv_core not being loaded as expected.
I would recommend opening up the jar file and checking the libraries inside of them. A "jar" file is basically like a zip file. You can un"jar" it.
(
I'd recommend copying your custom jar file into a temp directory and run:
"/opt/jdk1.8.0_40/bin/jar xvf opencv-3.4.0-1.4-linux-x86_64.jar" (replace with your jar filename)
this will extract the contents of the jar file into the current directory. Once that is done, you should be able to see the ".so" files. These are the native libraries (for a linux system.. on windows they would be .dll)
The output should look something like the following:
These are dynamically linked libraries, which means they likely depend on other things already being installed on the system.
One of the best tools for doing this is the "ldd" command.
The operating system will look in the LD_LIBRARY_PATH to find the operating system dependencies. (On windows, I think it's just PATH )
when you have a dynamic library you can run the command (change into directory that this file is in)
There might be some missing dependency on the operating system...
If you see a "file not found" for one of those listed linked depenencies for the native library.. that is what's missing and likely the reason it's not working. I suspect it's going to be the file libopencv_cudev.so .. but you will have to test and let us know what you find.
Good Luck!
NOTE: "jar" is part of the JDK (not part of the JRE) ... For my redhat linux that means the location of the "jar" command is in "/opt/jdk1.8.0_40/bin"
Wow, thank you Kwatters, this
Wow, thank you Kwatters, this was really good info, and as usual i learned a lot:)
Will dissect the jar tonight, i am stubborn, i never give up before it works...
nvidia@tegra-ubuntu:~/jar
To be built: aruco bgsegm bioinspired calib3d core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev dnn face features2d flann highgui img_hash imgcodecs imgproc java java_bindings_generator ml objdetect optflow phase_unwrapping photo plot python_bindings_generator shape stitching structured_light superres text tracking video videoio videostab xfeatures2d ximgproc xphoto
Disabled by dependency: -
the ldd output looked good..
Ok, so that output looked good. Clearly those library files are compiled correctly and have all the dependencies needed to make sure ldd is happy.
Now that you have extracted the jar file.. try copying all of the *.so* files into the MRL/libraries/native directory ...
In MyRobotLab, native libraries that are no packaged into a jar file will be loaded from the libraries/native directory... you might be able to trick MRL into picking those libraries up from that location..
Beyond that, i'm starting to run out of tricks to try...
@kwatters. Haven't started
@kwatters.
Haven't started to do more debugging yet, but just for fun i opened another terminal windows and did a dmesg -wH, and once i press capture in opencv i can see that it powers up / looks for my cameras, so at least i now know the opencv module is compiled correctly :)
EDIT:
Got a tip from Saudet that i should compile with linux-arm64 and not linux-aarch64 (but stil as aarch64 code), that WORKEY :)
mvn install -Djavacpp.platform=linux-arm64
I can now just copy the new jar and into libraries and Nixie / Mrl finds it, left to do, get picture :D
Results from todays test's:A
Results from todays test's:
A normal logitech 922 works with my opencv txt jar.
And if i set up a gstream server on the tx2 (using my csi cam's) and connect to the stream with opencv it works, but gives bad face recon, etc, since the tx2 also then needs to encode a h265 stream at the same time it does the face recon...
So my problem is:
I have only eralyer tested the nvcamerasrc (Nvidia thingy) and gstreamer to capure / display video on my TX2, i did do a v4l2 compliance test and it passed (for some strange reason) , it was now that i suddenly needed v4l i realy tested it and it's not worky like it should, nvidia has deprecated a parameter "pixel_T" that i need to fix in my camera drivers, this kills v4l :/
when i get v4l fixed we can direct connect to the cam and want eat up cpu / gpu cycles doing h265encode / decode...
@Alexinator:
if you want to test streming follow this guide, but using a face recon filer makes it useless at the moment since all frames are buffered somewher, so if you move or do a chnge in the picture you will see it a few minuttes after :)
but her you go: (remember to turn op clocks and fan from home dir sudo./jetson_clocks.sh)
wget https://gstreamer.freedesktop.org/src/gst-rtsp-server/gst-rtsp-server-1.8.3.tar.xz
tar -xvf gst-rtsp-server-1.8.3.tar.xz
cd gst-rtsp-server-1.8.3
./configure --libdir=/usr/lib/arm-linux-gnueabihf/
make
cd examples
start stream with :
./test-launch "( nvcamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=820, height=616, framerate=30/1, format=NV12 ! omxh265enc ! rtph265pay name=pay0 pt=96 )"
fire up mrl and opencv, choose opencv , press file, and chnage whats in the file box with:
rtsp://127.0.0.1:8554/test
Press capture and you should have live video :)
new jar for you in this OneDrive link: https://1drv.ms/u/s!Asf9doI7WS5djfYo2qjcDPKYmgsbCg
to big for email..
@kwatters, Found this
@kwatters,
Found this example on how the tx2 access the cam directly from native opencv, it might even make sense to you, i don't know python, if you see that "nvcamerasrc" thats the clue i think, and raspi probably has its own "broadcom" version of it !
https://github.com/jetsonhacks/buildOpenCVTX2/blob/master/Examples/cann…
and:
https://github.com/jetsonhacks/buildOpenCVTX2/blob/master/Examples/gstr…
would this be enough info to write a new grabber ? this should be possible in mrl ?
seem like the equivalent to "nvcamerasrc" is "raspivid" on the raspi :
https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspivi…
libnd4j compile on the raspi3
Here's the contents of my pi.cmake file. (you'll see it's used to point to the gcc / g++ compilers and sets a few other properties like the root file system so it can find all of the includes for c/c++ compilation)
need some basic java /
need some basic java / maven learning help her i think :)
pre buildt nd4j-cuda x86 x64 ?
@Kwatter or anyone else :)
Do you know if there is any pre buildt nd4j-cuda-9.1-1.0.0-beta-windows-x86_64.jar and nd4j-cuda-platform to be found somewhere ?
Need those to test cuda on the X86 C64 platform first :/
Late to the game as usual...
@Spawn32,
So from reading this and also the Github issue board for JavaCV it looks like you have fixed the issues and can compile Nixie and have OpenCV inside MRL worky for the JetsonTX2. Is that code part of the Nixie Project code base? I have been attempting to just grab myrobotlab.jar from latest link, but I am guessing that may not have it all in it.
Do you happen to have the myrobotlab.jar that I can use to install whatever version of MRL you have working on the Jetson TX2. I was hoping to get this all running over Christmas but have just not been able to get it all working.
Thanks!
Kyle