# Imported model have lower accuracy

**URL:** <https://community.konduit.ai/t/imported-model-have-lower-accuracy/2711>\
**Category:** Tuning Help\
**Created:** [July 31, 2023, 1:16am UTC](https://community.konduit.ai/t/imported-model-have-lower-accuracy/2711 "2023-07-31T01:16:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![minyueyong](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/minyueyong/32/780_2.png) [@minyueyong](https://community.konduit.ai/u/minyueyong)\
**Post date:** [July 31, 2023, 1:16am UTC](https://community.konduit.ai/t/imported-model-have-lower-accuracy/2711/1 "2023-07-31T01:16:55Z")

</div>

I want to import a tensorflow model.h5 file. The model will take in an image and predict whether its a real or fake face. But the newly imported DL4J model is not as accurate as the original tensorflow model. Is there any things I can fix about it ?

> NativeImageLoader loader = new NativeImageLoader(height, width, 3);  
> INDArray image = loader.asMatrix(file, false);
> 
> //Normalization  
> DataNormalization scalar = new ImagePreProcessingScaler(0, 1);  
> scalar.transform(image);
> 
> //Read in model file  
> File resourcesDirectory = new File(“src/main/resources”);  
> final String SIMPLE\_MLP = new File(resourcesDirectory.getAbsolutePath(), “model.h5”).getAbsolutePath();
> 
> //Predict Result  
> ComputationGraph model = KerasModelImport.importKerasModelAndWeights(SIMPLE\_MLP, true);  
> INDArray results = model.outputSingle(image);

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [July 31, 2023, 10:33am UTC](https://community.konduit.ai/t/imported-model-have-lower-accuracy/2711/2 "2023-07-31T10:33:30Z")

</div>

@minyueyong there are a lot of variables to consider here. Could you show the equivalent code from tensorflow to make sure the data pipelines are equivalent?

---

<div class="post-metadata">

**Author:** ![minyueyong](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/minyueyong/32/780_2.png) [@minyueyong](https://community.konduit.ai/u/minyueyong)\
**Post date:** [August 1, 2023, 3:39am UTC](https://community.konduit.ai/t/imported-model-have-lower-accuracy/2711/3 "2023-08-01T03:39:37Z")

</div>

Hi , here is the model summary , h5 file and sample image for the tensorflow model.

Is it enough to troubleshoot?

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fdrive.google.com%2Fdrive%2Ffolders%2F1cWRhPuYHz6qLkrV4Oc_I4uY4lDO7VC1k%3Fusp%3Ddrive_link&followup=https%3A%2F%2Fdrive.google.com%2Fdrive%2Ffolders%2F1cWRhPuYHz6qLkrV4Oc_I4uY4lDO7VC1k%3Fusp%3Ddrive_link&ifkv=AeDOFXh8pHUEx7Q_m3pSwwnfvBwvjH6qbtRvOD42RzW8bGVTNA7eEjstuLEbo63VR2aPQdst6gr35Q&osid=1&passive=1209600&service=wise&flowName=WebLiteSignIn&flowEntry=ServiceLogin&dsh=S-2113488611%3A1690861518424830)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [August 1, 2023, 11:33pm UTC](https://community.konduit.ai/t/imported-model-have-lower-accuracy/2711/4 "2023-08-01T23:33:18Z")

</div>

@minyueyong can you make this a bit easier? I would prefer to not have to download something if possible. All you did was give me a drive link I can’t even access. For now just start with the model summary and code. I’m not here to learn your full code base. I’m here to try to help you. Please try to minimize the amount of work I have to do to do that.
