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

How to emulate this project? #2

Open
wenzhe-zhao opened this issue Mar 14, 2018 · 6 comments
Open

How to emulate this project? #2

wenzhe-zhao opened this issue Mar 14, 2018 · 6 comments

Comments

@wenzhe-zhao
Copy link

Hi, guys.

I want to launch this code in emulation of SDx environment. Nevertheless, I met some problems as follows:
In main() function, the program load image from '/mnt/img/*.pgm', which works well when we burn the bitstream to SD card. However, when the program works in emulation method, it cannot find the image location. I do not know how to indicate the proper directory for the program loading image. I tried to add /mnt directory and image file on $prj/Debug/_SD_Card/, also tried to create image file on /mnt of host. neither works.

Any advice about how to indicate the load image directory in emulation environment? Thank you~

@seakros
Copy link
Collaborator

seakros commented Mar 14, 2018

If I understand correctly, you essentially want to run a C Simulation on your computer, yes? In this case, just change the directories in the sprintf statements at lines 87-92 of Topmain.cpp to something local, e.g. "/home/user/directory/of/pictures/filename.pgm". As it is, its coded quite specifically for testing images from the KITTI dataset and using the specific names of the files therein, but modifying that shouldn't be a problem.

Keep in mind that the reading and writing of images is implemented manually in Topmain.cpp (limited to .pgm images). The right image size parameters need to be specified in Topmain.h (rows, cols). Also, the header in the PGM images must be contained to the first line of the file and must be, on the subsequent line, immediately followed by the image data (no comments or anything else - if using ffmpeg to convert images to PGM, it may be necessary to ensure that they meet these criteria).

Although this is less flexible, it eliminates any dependency on OpenCV to load/store images. Otherwise, this would involve additionally cross-compiling/linking OpenCV which may complicate the process for someone trying to get up and running as easily as possible.

If someone wishes to contribute to the repository and fork a version that adds OpenCV support for reading/writing images as well as handling them in the accelerators, that would be tremendously appreciated! I may look at doing this in the future myself, but at the moment, I just don't have the time!

@wenzhe-zhao
Copy link
Author

Many thanks for your kindly reply. I have modified the path of input image in Topmain.cpp, and changed the cols and rows in Topmain.h. however, the fopen() still cannot open the input image correctly. Nevertheless, now I have launched this code in ZCU102 dev. board, which can avoid the above problem, while involve another problem. Let me describe it below.

@wenzhe-zhao
Copy link
Author

wenzhe-zhao commented Mar 14, 2018

When running the project on ZCU102 dev. board, I meet segment false as follows: "ERROR: application performed illegal memory access and is being terminated.". I located this bug in debug mode and found the program crashes when it writes the FinalResult array to file. Below is some information:
the output of the program is:
selection_028
the stack in the system crash is:
selection_027
the PC points to fwrite function when the system crashes:
selection_026

I double checked the code, but have not found any mistake. do you have any idea about this problem? Thanks for your kind reply.

@wenzhe-zhao
Copy link
Author

This problem is fixed. we instead the allocate method of the FinalResult by conventional malloc(). It works well. So this thread can be closed. Thank you~

@seakros seakros reopened this Mar 29, 2018
@seakros
Copy link
Collaborator

seakros commented Mar 29, 2018

Hi Wenzhe,

Sorry for the delay in getting back to you! I think I've come across this issue myself when testing and I believe it has something to do with the SD Card getting corrupted. Please try the following to see if it does not fix your solution: Before copying the contents of the sd_card folder onto the SD Card (as well as the test images), please reformat the SD card completely (FAT). In essence, wiping the SD card to a fresh state before every use.

It is much more advantage to use sds_malloc and not just malloc as the former ensures that the data is stored in a contiguous manner that allows for efficient speedup when being read/written by the DMAs. Using the latter will not allow for the same amount of speedup!

@wenzhe-zhao
Copy link
Author

Thank you seakros~ I will try it later and make feedback after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants