Skip to content

Deep Features

Alexandre Yuji Kajihara edited this page Jan 25, 2024 · 2 revisions

Requirements

  • The extract features using CNN require the installation of CUDA.
  • The NVIDIA offered this guide;
  • Remember the install CUDNN.

Attention

The images must have equal width and height.

Run (via terminal):

  1. Clone this repository;
$ git clone https://github.com/xaaaandao/piperaceae-features
  1. Access the repository in the terminal;
$ git clone https://github.com/xaaaandao/piperaceae-features
  1. Next, it shows an example of how to run a code.
$ python main.py --input
  • The list below contains the arguments available.
Usage: main.py [OPTIONS]

Options:
  --color [RGB|grayscale]         Color of image input.
  --contrast FLOAT                Value that to use in adjusting the contrast.
  -f, --folds INTEGER             Number of classes in the dataset.
  --gpu INTEGER                   ID of GPU.
  -h, --height INTEGER            Height of image input.  [required]
  -i, --input PATH                Path to images.  [required]
  -m, --model [vgg16|resnet50v2|mobilenetv2]
                                  A model to extract the features.  [required]
  --orientation [horizontal|vertical|horizontal+vertical]
                                  An orientation of patches must made in an
                                  image.  [required]
  -o, --output PATH               Path to store the NPZ, NPY, and CSV files.
                                  [required]
  -p, --patches INTEGER           A number the patches must made in an image.
  -w, --width INTEGER             Width of image input.  [required]
  --help                          Show this message and exit.

Run (PyCharm Professional):

  1. Clone this repository;
$ git clone https://github.com/xaaaandao/piperaceae-features
  1. Open a project;

ksnip_20240125-194929

  1. Set the folder that contains the image and other arguments;

ksnip_20240125-195736

  1. To run, press SHIFT+F10 (or run button).

ksnip_20240125-200430

Output

  • This program will create a folder called mobilenetv2, resnet50v2, or vgg16 (depending on user choice).
    • mobilenetv2

      • A count of files npz or npy
        • Each file contains 1280 columns
      • info.csv, info_levels.csv, info_sample.csv
    • resnet50v2

      • A count of files npz or npy
        • Each file contains 2048 columns
      • info.csv, info_levels.csv, info_sample.csv
    • vgg16

      • a count of files npz or npy
        • Each file contains 512 columns
      • info.csv, info_levels.csv, info_sample.csv
    • A count of files npz and npy depends on the class count in the dataset.

      • For example, the o dataset contains 100 classes. Therefore, the code will create 100 files.
    • The difference between npz and npy files is that npz files separate features of classes.

    • info_levels.csv and info_samples.csv are files equal between three folders.

      • It is created for each folder to facilitate the next step (identification).
      • This link contains the mean of each row.
    • info.csv

      • The difference is the value of each row.
      • This link contains the mean of each row.

Clone this wiki locally