Answers.Body: <p>Well probably the response is that previous approach was a little naive.
  I managed to fave some interesting result <a href="https://www.kaggle.com/felicepollano/starter-watermarked-not-watermarked-e54da0df-f?scriptVersionId=44273914" rel="nofollow noreferrer">with this kernel</a> that allow me to have an <strong>accuracy of 0.969</strong>  and a <strong>validation accuracy of 0.931</strong>.
  Model I used is based on <strong>ResNet50</strong> with the following additional layers ( and the last one just for binary classification ):</p>
  <pre><code>tf.keras.layers.Dense(64, activation='relu'),
  tf.keras.layers.Dense(32, activation='relu'),
  tf.keras.layers.Dense(1,activation=&quot;sigmoid&quot;)
  </code></pre>
  <p>Even if the net is already trained, I trained each layer again otherwise I did not have any sensible accuracy.</p>
  <p>Training history is like this:</p>
  <p><a href="https://i.sstatic.net/iuyIS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iuyIS.png" alt="enter image description here" /></a></p>
  <p>Still far to be really good, but progress.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-08T15:05:56.290Z
Answers.LastActivityDate: 2020-10-08T15:05:56.290Z
Answers.UserDisplayName: Felice Pollano
Body: <p>Just starting learning things about tensorflow and NN.
  As an exercise I decided to create a dataset of images, watermarked and not, in order to binary classify these. First of all, the dataset ( you can see it <a href="https://www.kaggle.com/felicepollano/watermarked-not-watermarked-images" rel="nofollow noreferrer">here</a> ) was created artificially by me applying some random watermarks.
  First doubt, in the dataset I don't have both images one watermarked and one not, would be better to have?
  Second, frustrating: model stand on 0.5 accuracy, so it just produce random output :(
  Model I tried is this:</p>
  <pre><code>model = tf.keras.Sequential([
      tf.keras.layers.Conv2D(16,(1,1), activation='relu', input_shape=(150, 150, 3)),
      tf.keras.layers.MaxPool2D(2,2),
      tf.keras.layers.Conv2D(32,(3,3), activation='relu'),
      tf.keras.layers.MaxPool2D(2,2),
      tf.keras.layers.Conv2D(64,(3,3), activation='relu'),
      tf.keras.layers.MaxPool2D(2,2),
      tf.keras.layers.Flatten(),
      tf.keras.layers.Dense(128, activation='elu'),
      tf.keras.layers.Dense(64, activation='elu'),
      tf.keras.layers.Dense(32, activation='relu'),
      tf.keras.layers.Dense(1,activation=&quot;sigmoid&quot;)
  </code></pre>
  <p>and then compiled as this:</p>
  <pre><code>model.compile(optimizer='adam',
                loss='binary_crossentropy',
                metrics = ['accuracy'])
  </code></pre>
  <p>Here below the fit:</p>
  <pre><code>history = model.fit(train_data,
                                validation_data=valid_data,
                                steps_per_epoch=100,
                                epochs=15,
                                validation_steps=50,
                                verbose=2)
  </code></pre>
  <p>As for any other details, code is <a href="https://www.kaggle.com/felicepollano/starter-watermarked-not-watermarked-e54da0df-f" rel="nofollow noreferrer">here</a>.
  I already checked for technical issues, I'm pretty sure image enter properly, train and validation dataset are 80/20, about 12K images for training. However accuracy bounches up and down around .5 while fitting. How can I improve?</p>
  
Tags: <convolutional-neural-networks><tensorflow><keras><image-recognition><binary-classification>
Title: Image Classification for watermarks with poor results
UserDisplayName: Felice Pollano
ThreadText: # Image Classification for watermarks with poor results
  
  (Asked by: username_0 on 2020-10-02)
  
  Just starting learning things about tensorflow and NN.
  As an exercise I decided to create a dataset of images, watermarked and not, in order to binary classify these. First of all, the dataset ( you can see it [here](https://www.kaggle.com/username_0/watermarked-not-watermarked-images) ) was created artificially by me applying some random watermarks.
  First doubt, in the dataset I don't have both images one watermarked and one not, would be better to have?
  Second, frustrating: model stand on 0.5 accuracy, so it just produce random output :(
  Model I tried is this:
  
  ```
  model = tf.keras.Sequential([
      tf.keras.layers.Conv2D(16,(1,1), activation='relu', input_shape=(150, 150, 3)),
      tf.keras.layers.MaxPool2D(2,2),
      tf.keras.layers.Conv2D(32,(3,3), activation='relu'),
      tf.keras.layers.MaxPool2D(2,2),
      tf.keras.layers.Conv2D(64,(3,3), activation='relu'),
      tf.keras.layers.MaxPool2D(2,2),
      tf.keras.layers.Flatten(),
      tf.keras.layers.Dense(128, activation='elu'),
      tf.keras.layers.Dense(64, activation='elu'),
      tf.keras.layers.Dense(32, activation='relu'),
      tf.keras.layers.Dense(1,activation="sigmoid")
  
  ```
  
  and then compiled as this:
  
  ```
  model.compile(optimizer='adam',
                loss='binary_crossentropy',
                metrics = ['accuracy'])
  
  ```
  
  Here below the fit:
  
  ```
  history = model.fit(train_data,
                                validation_data=valid_data,
                                steps_per_epoch=100,
                                epochs=15,
                                validation_steps=50,
                                verbose=2)
  
  ```
  
  As for any other details, code is [here](https://www.kaggle.com/username_0/starter-watermarked-not-watermarked-e54da0df-f).
  I already checked for technical issues, I'm pretty sure image enter properly, train and validation dataset are 80/20, about 12K images for training. However accuracy bounches up and down around .5 while fitting. How can I improve?
  
  **Tags:** convolutional-neural-networks, tensorflow, keras, image-recognition, binary-classification
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-10-08. Score: 0 | Accepted answer
  
  Well probably the response is that previous approach was a little naive.
  I managed to fave some interesting result [with this kernel](https://www.kaggle.com/username_0/starter-watermarked-not-watermarked-e54da0df-f?scriptVersionId=44273914) that allow me to have an **accuracy of 0.969** and a **validation accuracy of 0.931**.
  Model I used is based on **ResNet50** with the following additional layers ( and the last one just for binary classification ):
  
  ```
  tf.keras.layers.Dense(64, activation='relu'),
  tf.keras.layers.Dense(32, activation='relu'),
  tf.keras.layers.Dense(1,activation="sigmoid")
  
  ```
  
  Even if the net is already trained, I trained each layer again otherwise I did not have any sensible accuracy.
  
  Training history is like this:
  
  [![enter image description here](https://i.sstatic.net/iuyIS.png)](https://i.sstatic.net/iuyIS.png)
  
  Still far to be really good, but progress.
  
  
  ---
  
  