Instructions to use DataScienceProject/CNN_And_ELA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use DataScienceProject/CNN_And_ELA with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://DataScienceProject/CNN_And_ELA") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from DataScienceProject/CNN_And_ELA: direct link, hf CLI and curl.
- Browser
- Download file 3.34 kB
-
https://huggingface.co/DataScienceProject/CNN_And_ELA/resolve/main/README.md
- Command line
-
hf download hf://DataScienceProject/CNN_And_ELA/README.md
-
curl -L -o README.md https://huggingface.co/DataScienceProject/CNN_And_ELA/resolve/main/README.md
3.34 kB
| license: unknown | |
| metrics: | |
| - accuracy | |
| tags: | |
| - art | |
| datasets: | |
| - DataScienceProject/Art_Images_Ai_And_Real_ | |
| library_name: keras | |
| language: | |
| - en | |
| pipeline_tag: image-classification | |
| # Model Card for Model ID | |
| This model is designed for classifying images as either 'real' or 'fake-AI generated' using a Convolutional Neural Network (CNN) combined with Error Level Analysis (ELA). | |
| Our goal is to accurately classify the source of the image with at least 85% accuracy and achieve at least 80% in the recall test. | |
| ### Model Description | |
| CNN is a type of deep learning model specifically designed to process and analyze visual data by applying convolutional layers that automatically detect patterns and features in images. | |
| Error Level Analysis (ELA) detects changes in digital images by comparing the differences between the original and a compressed version of the image. | |
| It highlights areas where alterations may have occurred, making it useful for identifying image tampering. | |
| After running ELA we feed the CNN with the result of comparing original and a compressed version of the same image and then we get the output. | |
| ### Direct Use | |
| This model can be used to classify images as 'real' or 'fake- Ai generated' based on the presence of anomalies and features characteristic of each category. | |
| ### Out-of-Scope Use | |
| The model may not perform well on images outside the scope of art or where the visual characteristics are drastically different from those in the training dataset. | |
| may not detect ai-images from newer diffusion models that has another method of creating ai images. | |
| ## Bias, Risks, and Limitations | |
| ELA can be very good in detecting tamparing such as photoshop, | |
| there is many diffusion engines that not tamper the image making the ELA weak against those ai-images. | |
| ### Recommendations | |
| Test this model with different hyperparameters / more CNN layers | |
| ## How to Get Started with the Model | |
| Prepare Data: Organize your images into appropriate folders and run the code | |
| ## Training Details | |
| -Dataset: DataScienceProject/Art_Images_Ai_And_Real_ | |
| -Preprocessing: Images are resized, image quallity changed , ELA version of this image created. | |
| ### Training Procedure | |
| Train the CNN with the Preprocessed images , use valitadion set. | |
| #### Training Hyperparameters | |
| -optimizer = RMSprop(lr=0.0005, rho=0.9, epsilon=1e-08, decay=0.0) | |
| -epochs = 22 | |
| -batch_size = 100 | |
| -loss = "categorical_crossentropy" | |
| -metrics=["accuracy"] | |
| -early_stopping = EarlyStopping(monitor='val_acc',min_delta=0,patience=2,verbose=0, mode='auto') | |
| ## CNN architecture | |
|  | |
| ## Evaluation | |
| The model takes 7-10 minutes to run , based on our dataset , equipped with the following pc hardware: cpu :i9 13900 ,ram: 32gb , gpu: rtx 3080 | |
| your mileage may vary. | |
| ### Testing Data, Factors & Metrics | |
| -precision | |
| -recall | |
| -f1 | |
| -confusion_matrix | |
| -accuracy | |
| ### Results | |
| -test accuracy = 0.853 | |
| -precision = 0.866 | |
| -recall = 0.8357 | |
| -f1 = 0.8509 | |
|  | |
| #### Summary | |
| The model preforms well and meet our initial goal ,thus this model can handle the task of image classification real image vs Ai generated image. |