/CropAI

Primary LanguageJupyter Notebook

CropAI

Image preprocessing

The raw image data is in the "RawData" folder. The code for image preprocessing is in the "CropImages" folder. The Crop.ipynb and the Crop.py are two versions doing same tasks. Instructions to run this two scripts are included at the top of the scripts within it. You may need to update some parameters according to the instructions. After running one of the two scripts, the cropped images should appear in the "CroppedImageData" folder.

Feature extraction

All scripts for feature extraction tasks are in the "FeaturesExtraction" folder. To extract features from image data, we use the following three method, the generated features will be saved into "csvFiles" after running any of the scripts accordingly.

Color Histogram

To differiate soybeans, the first method explored would be the Color Histogram of all the images of soybeans. ColorHist.ipynb is used to generate features extracted by color histogram method.

SIFT and OpponentSIFT

SIFT (short for Scale-invariant feature transform) is used to extract features from images, to get csv file for features extracted by SIFT method, run the notebook named SIFT.ipynb.

Since SIFT method is normally used to extract features for gray images, for our project, color is an important attribute to differentiate "ready to harvest" soybeans and soybeans that is late to harvest. Opponent SIFT method is designed to integrate color information for images along with other information that SIFT method could capture. To get csv file for features extracted Opponent SIFT method, run the notebook named OpponentSIFT.ipynb.

Pre-trained ResNet18

We use pre-trained ImageNet model to extract features. Because of lack of data, we chose ResNet18 with less layers. To get features extracted by pre-trained DNN model, run the notebook named Pre-trainedResNet.ipyno.

All csv files generated by different methods are saved in the csvFiles.

Andromeda Platform

After features extraction, all the csv files could be fitted into our Andromeda platform, where users could play iteractively with image data to help classify the image categories.

Scripts for Andromeda platform could be found in the Andromeda folder.