clementfarabet / torch-ios

Torch7 for iOS.
Other
196 stars 42 forks source link

How to load file using io.open('somefile', 'rb') #15

Open abcnet opened 8 years ago

abcnet commented 8 years ago

Hi, I have a question about how to load a file on iOS torch. I tried every effort (lfs, paths.files, ...) to get current working path of the lua file so that I could add files to that directory, but failed. Can you please help me out? Thanks a lot! By the way, it seems some packages do not work on iOS torch, such as nngraph, xlua, and gnuplot.

soumith commented 8 years ago

Could you see the example, maybe you can get hints there: https://github.com/clementfarabet/torch-ios/tree/ios/ios_examples/XOR_Example

abcnet commented 8 years ago

Yes I did. But this example only referenced one .lua file, and no other external files were loaded in the .lua file. So I am wondering if we can import an image file and process it inside the .lua file using io.open('image', 'rb'). But the problem is the image file could not be accessed even put in the same directory as the .lua file.

kurtjacobsdev commented 8 years ago

Hi @abcnet I will upload an example of how to load a pre-trained network model (ill call it XOR_Example_Pre) you should be able to leverage the same code to load up any file for use inside of Lua. I will try to do so in the next few days and submit a pull request from my branch.

abcnet commented 8 years ago

Hi @woffle. Does the latest commit already include the new example or you will upload it later? Thanks!

kurtjacobsdev commented 8 years ago

@abcnet I'll have time some free time over this weekend to add the code and then ill issue a pull request. hope thats okay.

abcnet commented 8 years ago

@woffle Great. Thanks !

kurtjacobsdev commented 8 years ago

@abcnet Hi just committed the updates to load files inside lua scripts. You can checkout my branch or wait for @soumith to merge into the main branch. Hope it works out for you.

abcnet commented 8 years ago

Great thanks!