-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make sure python Inception and scala Inception examples have the same result #2515
Comments
Any update? |
@jenniew Can you provide the example code to reproduce this issue? |
@wzhongyuan please take a look at this issue |
The python code and related parameters are same as scala ones, finally found the difference caused by preprocessing :) , Python uses OpenCV while Scala still uses legacy ones DataSet.SeqFileFolder.files(path, sc, classNumber).transform(
MTLabeledBGRImgToBatch[ByteRecord](
width = imageSize,
height = imageSize,
batchSize = batchSize,
transformer = (BytesToBGRImg() -> BGRImgCropper(imageSize, imageSize)
-> DatasetHFlip(0.5) -> BGRImgNormalizer(0.485, 0.456, 0.406, 0.229, 0.224, 0.225))
)) train_transformer = Pipeline([PixelBytesToMat(),
RandomCrop(image_size, image_size),
RandomTransformer(HFlip(), 0.5),
ChannelNormalize(0.485, 0.456, 0.406, 0.229, 0.224, 0.225),
MatToTensor(to_rgb=True),
ImageFrameToSample(input_keys=["imageTensor"], target_keys=["label"])
]) Will raise a PR to fix it |
Need to implement a replacement of |
I think the main issue is that the Top5 accuracy results of these two examples are different (the Scala version has higher accuracy). @jenniew can you provide the testing results? |
scala: top5: 88.2 top1: 68.2 |
Seems we cannot refactor scala code for now as python has worse performance... holding the change for now. |
@jenniew thanks for providing the data |
Python ChannelNormalize has an issue: #2544 |
caffe also uses opencv to transform, so I think using opencv would not decrease accuracy. |
@jenniew I think that's the issue causing the discrepancy. The training result after the fix is much better now. I will put the fix in, quite simple change. |
Will refactor the scala transformers as well |
I believe caffe also use opencv based preprocessing? maybe we can just compared to caffe. |
We mirrored intel caffe (please refer to #2555), but did not get compatible result, the final accuracy is below than what we've done with legacy transformers. |
Closing this issue as it's fixed |
Reopen - cannot reproduce the results |
Probably caused by regression from commit ce7e573 , this commit is made after the convergence testing. we'll check and get back. |
Especially for the training results.
The text was updated successfully, but these errors were encountered: