<jupyter_start><jupyter_text>A Simple Image Classifier on Satellite Images using Tensorflow- [link](https://medium.com/@ije_good/a-simple-image-classifier-on-satellite-imagery-using-tensorflow-3df5a328bf2) to the article1. lone this repository.2. Load your data. Make sure the data is contained in one folder and that its class/label is apparent from the image name in the following format: 0__xyz.jpg vs 1__xyz.jpg, where 0 denotes a negative example and 1 a positive one.3. From the cloned repository, run !python organize_idg.py -s {SOURCE_PATH}.  Import packages<jupyter_code>from tensorflow.keras.preprocessing.image import ImageDataGenerator
!git clone https://github.com/ijeism/ImageDataGenerator_data_prep<jupyter_output><empty_output><jupyter_text>Load data<jupyter_code>""" 
Data for this example can be obtained from Kaggle. Make sure the data used is contained 
in one folder and that its class/label is apparent from the image name 
(i.e. 0__xyz.jpg vs 1__xyz.jpg, where O denotes a negative example and 1 a positive one).
""" 

# os.environ['KAGGLE_USERNAME'] = "XXX" 
# os.environ['KAGGLE_KEY'] = "XXX" 
# !kaggle datasets download rhammell/ships-in-satellite-imagery -p /PATH/TO/SOURCE/IMAGES/FOLDER/ --unzip<jupyter_output><empty_output><jupyter_text>Define images source path<jupyter_code>SOURCE_PATH = '/PATH/TO/SOURCE/IMAGES/FOLDER/'<jupyter_output><empty_output><jupyter_text>Structure data<jupyter_code># from ImageDataGenerator_data_prep directory
# %cd /PATH/TO/ImageDataGenerator_data_prep

!python organize_idg.py \
-s {SOURCE_PATH} \
-p 0.8 # optional, default = 0.7<jupyter_output>There are 1000 Positives.
There are 3000 Negatives.
Populating Training and Test directories for 
There are 800 Training images
There are 200 Test images
Populating Training and Test directories for 
There are 2400 Training images
There are 600 Test images<jupyter_text>Use ImageDataGenerator to create batches of tensor image data ready for training<jupyter_code>"""
Run this from the ImageDataGenerator_data_prep directory 
OR
use absolute path for TRAINING_DIR and VALIDATION_DIR
"""

TRAINING_DIR = "training" # use absolute path if not running from repo

train_datagen = ImageDataGenerator(rescale=1./255)
train_generator = train_datagen.flow_from_directory(TRAINING_DIR,
                                                    batch_size=100,
                                                    class_mode='binary',
                                                    target_size=(150, 150))


TEST_DIR = "testing" # use absolute path if not running from repo

test_datagen = ImageDataGenerator(rescale=1./255)
test_generator = test_datagen.flow_from_directory(TEST_DIR,
                                                              batch_size=100,
                                                              class_mode='binary',
                                                              target_size=(150, 150))<jupyter_output>Found 3200 images belonging to 2 classes.
Found 800 images belonging to 2 classes.
{'fraction_non_alphanumeric': 0.07402511566424323, 'fraction_numerical': 0.02511566424322538, 'mean_word_length': 3.180939226519337, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '605812', 'license': 'Apache-2.0', 'n_tokens_mistral': 922, 'n_tokens_neox': 837, 'n_words': 261, 'path': 'model_ideas/Tutorial_A_Simple_Image_Classifier_on_Satellite_Images_using_Tensorflow.ipynb', 'repo_name': 'JonathanLehner/cassini_2021_nature_discoverer', 'size': '3026'}