mofanv / darknetz

runs several layers of a deep learning model in TrustZone
MIT License
86 stars 29 forks source link

Couldn't access weights file after training #20

Closed shibz-islam closed 3 years ago

shibz-islam commented 3 years ago

Hi, I tried to train the model on QEMU-v8 with OP-TEE 3.10.0. After the process finished, it tried to save the weights, but couldn't open the file in the tmp/backup directory. Here's the log:

# darknetp classifier train -pp_start 2 -pp_end 10 cfg/mnist.dataset cfg/mnist_l
enet.cfg
Prepare session with the TA
Begin darknet
mnist_lenet
1
layer     filters    size              input                output
    0 conv      6  5 x 5 / 1    28 x  28 x   3   ->    28 x  28 x   6  0.001 BFLOPs
    1 max          2 x 2 / 2    28 x  28 x   6   ->    14 x  14 x   6
    2 conv_TA    6  5 x 5 / 1    14 x  14 x   6   ->    14 x  14 x   6  0.000 BFLOPs
    3 max_TA       2 x 2 / 2    14 x  14 x   6   ->     7 x   7 x   6
    4 connected_TA                          294  ->   120
    5 dropout_TA    p = 0.80                120  ->   120
    6 connected_TA                          120  ->    84
    7 dropout_TA    p = 0.80                 84  ->    84
    8 connected_TA                           84  ->    10
    9 softmax_TA                                       10
   10 cost_TA                                          10
workspace_size=235200
Learning Rate: 0.3, Momentum: 0.9, Decay: 5e-05
3000
28 28
output file: /media/results/train_mnist_lenet_pps2_ppe10.txt
current_batch=0 
Loaded: 0.219263 seconds
1, 0.033: 0.000000, 0.000000 avg, 0.298802 rate, 5.330773 seconds, 100 images
user CPU start: 1.535481; end: 7.408529
kernel CPU start: 3.927328; end: 3.927328
Max: 14976  kilobytes
vmsize:1037248; vmrss:13416; vmdata:53548; vmstk:132; vmexe:432; vmlib:2280
Loaded: 0.000431 seconds
2, 0.067: 0.000000, 0.000000 avg, 0.297607 rate, 5.216192 seconds, 200 images
user CPU start: 7.413332; end: 12.828843
kernel CPU start: 3.927328; end: 3.927328
Max: 19840  kilobytes
vmsize:1037248; vmrss:13776; vmdata:53812; vmstk:132; vmexe:432; vmlib:2280

At the end of the process:

Loaded: 0.000476 seconds
1000, 33.333: 0.000000, 0.000000 avg, 0.000000 rate, 4.992810 seconds, 100000 images
user CPU start: 4903.527241; end: 4908.466377
kernel CPU start: 331.553209; end: 331.853131
Max: 24952  kilobytes
vmsize:1037180; vmrss:16744; vmdata:55588; vmstk:132; vmexe:432; vmlib:2280
Saving weights to tmp/backup/mnist_lenet.weights
Couldn't open file: tmp/backup/mnist_lenet.weights

Then I realized there was no tmp/backup directory in root. So, I created tmp inside root and backup inside tmp. Then I ran the program again and this time I got no errors. But I couldn't find the weights file anywhere.

Loaded: 0.000713 seconds
1000, 33.333: 0.000000, 0.000000 avg, 0.000000 rate, 5.079499 seconds, 100000 images
user CPU start: 4939.497528; end: 4944.462404
kernel CPU start: 350.172044; end: 350.464667
Max: 24452  kilobytes
vmsize:1037228; vmrss:16260; vmdata:55940; vmstk:132; vmexe:432; vmlib:2280
Saving weights to tmp/backup/mnist_lenet.weights

From the QEMU terminal, I could see there's a mnist_lenet.weights file hidden in the tmp/backup with command ls -a. But is there anyway to access the weights file? I tried to copy it to other directories outside the root but failed.

Any help would be really appreciated. Thanks.

James567 commented 3 years ago

Hi @shibz-islam
I have the same problem. So have you solved this problem?

shibz-islam commented 3 years ago

Hi @James567 I was able to access the weights file by sharing folder between host and guest OSes. You will find the necessary info here: https://optee.readthedocs.io/en/latest/building/devices/qemu.html?highlight=VirtFS%20QEMU#host-guest-folder-sharing I hope this is the right approach!

James567 commented 3 years ago

@shibz-islam thank you very much , hope this is the right approach too!

Xxxgrey commented 8 months ago

Hi @James567 I was able to access the weights file by sharing folder between host and guest OSes. You will find the necessary info here: https://optee.readthedocs.io/en/latest/building/devices/qemu.html?highlight=VirtFS%20QEMU#host-guest-folder-sharing I hope this is the right approach!

Hello!I follow your instructions, but I still can't see it in the folder, but use ls can see it. Could you please help me solve it?

James567 commented 8 months ago

HI @Xxxgrey

make QEMU_VIRTFS_AUTOMOUNT=y run

I use this command and it works for me.

Xxxgrey commented 8 months ago

HI @Xxxgrey

make QEMU_VIRTFS_AUTOMOUNT=y run

I use this command and it works for me.

Thanks a lot .I'm going to try it.