Skip to content

Maithilishetty/Acute-Infarct-DL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Requirements:

  1. Python 3.x
  2. Tensorflow 1.15
  3. pandas, tabula-py, nltk, matplotlib, keras, numpy, tensorflow and opencv modules (can be install using "pip install <module_name>, <module_name> ...")
  4. For tabula, JAVA needs to be installed and has to be added to the PATH variables in windows.
    To do this after installing JAVA, copy the path of the "bin" folder of the installation and add it to path variables by editing the system environment variables on the windows platform.

Required Directories:

  1. "Assignment_2" directory with all the case folders and patient information pdf file
  2. "src" folder which has all the source codes (13 .py files)
  3. "Inference_Data" dir which contains data for performing inference.
    (All these folders should be in the same directory like Desktop or Documents or any other folder)

Initial file sturcture:
Any folder (Documents or Desktop etc)
    |
    +-- dir Assignment_2 (folder with all case folders and pdf)
    |        |
    |        +-- dir Case 1
    |        +-- dir Case 2 ...
    |
    +-- dir Inference_Data (folder with inference data)
    |        |
    |        +-- dir Case 1
    |        +-- dir Case 2 ...
    |
    +-- dir src (folder with all source code)
    |        |
    |        +-- file main.py
    |        +-- file read_pdf_file.py
    |        +-- file table_querry.py
    |        +-- file renaming_image_files.py
    |        +-- file filter_images.py
    |        +-- file datasplit.py
    |        +-- file folder_name_cleaning.py
    |        +-- file cnn_model.py
    |        +-- file keras_to_tf.py
    |        +-- file inference_test2.py
    |        +-- file inference_test.py
    |        +-- file final.py
    |        +-- file generate_images.py
    |        +-- file cnn_model.py_plot.png
    |
    +-- file readme.md
    +-- file .gitignore

Running the code:

  1. Open the "src" folder.
  2. Open the file named as "main.py" and run it.
  3. Next run "generate_images.py". This performs data augmentation on the training data.
  4. Run "cnn_model.py" next.
  5. Now use the Intel model_optimizer and generate xml and bin files for the model. The generated xml and bin files should be in the "src" folder. The command line commands for the model optimizer are given further below.
  6. Finally run "final.py" from the cmd window for performing inference.

Outputs generated:

  1. Creates a folder called "output".
  2. This folder contains the csv file generated (ACUTE_INFARCTS_Updated.csv and Inference_Data_GroundTruths.csv) and used by the code and also contains 2 other folders called "CLEANED_DATA" and "Infer_data".
  3. "CLEANED_DATA" contains folders folders named as the location of the brain infarcts and each of these folders contains the brain images of the person who has an infarcts at that particular location.
  4. "CLEANED_DATA" also contains the "test" and "train" folders which has data used by the CNN model.
  5. "Infer_data" folder contains the data to be used during inference.
  6. In the "src" folder, the model files which are generated are saved.

CMD Commands:

  1. To generate an XML and bin file:
        a. Run the setupvars.bat file to initialize the OpenVino Environment.
        b. Go to the model optimizer folder in IntelSWTools and run: python mo_tf.py --input_model <input_model_destination>.pb -b 1 --output_dir <output_directory> --scale 255 --data_type FP32
  2. To obtain an inference of single input image:
        a. python inference_test.py -m <model_destination>.xml -i <input_image>
  3. To obtain inference of all images:
        a. python final.py

About

Acute Infarct Location Classification using CNN.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages