apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.79k stars 6.79k forks source link

Why Train-accuracy and Validation-accuracy has so big separation? #2359

Closed dushoufu closed 8 years ago

dushoufu commented 8 years ago

I use the same train and validation set with the same preparing parameters,but the Train-accuracy and Validation-accuracy has a so big separation. According to my thought, they should be the same. Does this mean my program has something wrong?

def deepid_iterator(batch_size, input_shape): """return train and val iterators for deepid"""

train = mx.io.ImageRecordIter(
    path_imgrec = "./test.rec",
    data_shape  = input_shape,
    batch_size  = batch_size)

val = mx.io.ImageRecordIter(
    path_imgrec = "./test.rec",
    data_shape  = input_shape,
    batch_size  = batch_size)
return (train, val)

~

INFO:root:Epoch[0] Resetting Data Iterator INFO:root:Epoch[0] Train-accuracy=0.000000 INFO:root:Epoch[0] Time cost=0.618 INFO:root:Epoch[0] Validation-accuracy=0.003906 INFO:root:Epoch[1] Resetting Data Iterator INFO:root:Epoch[1] Train-accuracy=0.009766 INFO:root:Epoch[1] Time cost=0.414 INFO:root:Epoch[1] Validation-accuracy=0.005859 INFO:root:Epoch[2] Resetting Data Iterator INFO:root:Epoch[2] Train-accuracy=0.119141 INFO:root:Epoch[2] Time cost=0.415 INFO:root:Epoch[2] Validation-accuracy=0.001953 INFO:root:Epoch[3] Resetting Data Iterator INFO:root:Epoch[3] Train-accuracy=0.130859 INFO:root:Epoch[3] Time cost=0.414 INFO:root:Epoch[3] Validation-accuracy=0.007812 INFO:root:Epoch[4] Resetting Data Iterator INFO:root:Epoch[4] Train-accuracy=0.101562 INFO:root:Epoch[4] Time cost=0.415 INFO:root:Epoch[4] Validation-accuracy=0.011719 INFO:root:Epoch[5] Resetting Data Iterator INFO:root:Epoch[5] Train-accuracy=0.126953 INFO:root:Epoch[5] Time cost=0.416 INFO:root:Epoch[5] Validation-accuracy=0.009766 INFO:root:Epoch[6] Resetting Data Iterator INFO:root:Epoch[6] Train-accuracy=0.162109 INFO:root:Epoch[6] Time cost=0.413 INFO:root:Epoch[6] Validation-accuracy=0.023438 INFO:root:Epoch[7] Resetting Data Iterator INFO:root:Epoch[7] Train-accuracy=0.255859 INFO:root:Epoch[7] Time cost=0.415 INFO:root:Epoch[7] Validation-accuracy=0.039062 INFO:root:Epoch[8] Resetting Data Iterator INFO:root:Epoch[8] Train-accuracy=0.386719 INFO:root:Epoch[8] Time cost=0.414 INFO:root:Epoch[8] Validation-accuracy=0.048828 INFO:root:Epoch[9] Resetting Data Iterator INFO:root:Epoch[9] Train-accuracy=0.541016 INFO:root:Epoch[9] Time cost=0.415 INFO:root:Epoch[9] Validation-accuracy=0.066406 INFO:root:Epoch[10] Resetting Data Iterator INFO:root:Epoch[10] Train-accuracy=0.654297 INFO:root:Epoch[10] Time cost=0.418 INFO:root:Epoch[10] Validation-accuracy=0.039062 INFO:root:Epoch[11] Resetting Data Iterator INFO:root:Epoch[11] Train-accuracy=0.806641 INFO:root:Epoch[11] Time cost=0.415 INFO:root:Epoch[11] Validation-accuracy=0.140625

mli commented 8 years ago

it could be the default ImageRecordIter has randomness enabled. you need disable all of them.

dushoufu commented 8 years ago

I figure out my mistake.

ysh329 commented 7 years ago

@dushoufu Hi, can you share your DeepID model? Thanks a lot!

dushoufu commented 7 years ago

@ysh329, Hi deepid is from company's project. It's not convenient to share with you. But I indeed think now deepid is not that valuable in terms of face recongnition. We have already turned to other models from open source.

ysh329 commented 7 years ago

@dushoufu Can you give a little pointing about open source face recongnition model? Thanks a lot!

dushoufu commented 7 years ago

https://github.com/tornadomeet/mxnet-face

ysh329 commented 7 years ago

@dushoufu Thanks! :+1: