process and result folders from ML training (Not included in this repository).To run the AI-biopsy framework please follow these steps:
Install TensorFlow. Follow the instructions from here.
Pre-trained Models of CNN architectures should be downloaded from the "Pre-trained Models" part of https://github.com/wenwei202/terngrad/tree/master/slim#pre-trained-models and be located in your machine (e.g. GitHub_AI-biopsy/scripts/slim/run/checkpoint). The files for pre-trained models are available under the column named "Checkpoint".
Divide the images with the original size into two or more classes based on the aim of classification (e.g., discrimination of aggressive and non-aggressive). 85% of images in each class will be selected as Train set (train and validation) and 15% for Test set.
_NUM_CLASSES should be set in embryo.py (this script is located in AI-biopsy/scripts/slim/datasets).
Run the convert.py (it is located in the AI-biopsy/scripts directory) to allocate the suitable percentage of images to train and validation sets. The convert.py needs three arguments including:
python convert.py ../Images/train process/ 0
The Inception-V1 architecture should be run on the Train set images from the "AI-biopsy/scripts/slim" directory. First got the the following directory: AI-biopsy /scripts/slim. Then open load_inception_v1.sh located in "run/" directory and edit PRETRAINED_CHECKPOINT_DIR, TRAIN_DIR, and DATASET_DIR addresses. See the load_inception_v1.sh, for instance. Then, run the following command in shell script:
$ ./run/load_inception_v1.sh
chmod 777 load_inception_v1.sh
The trained algorithms should be tested using test set images. In folder " AI-biopsy /scripts/slim", predict.py loads a trained model on provided images. This code get 5 arguments:
python predict.py v1 ../result/ ../../Images/test output.txt 2
The accuracy can be measured using accuracy measurement codes ("acc.py") in "useful" folder. The output.txt file should be in the same folder that you are running acc.py. Then run the following code:
python acc.py
DOCKER_CONTAINER_NAME=ai_biopsy
AI_BIOPSY_PORT=3002
OUTPUT_DIR=/stork/data/ai_biopsy/output/
UPLOAD_DIR=/stork/data/ai_biopsy/uploads/
PROCESS_DIR=/stork/data/ai_biopsy/process/
RESULT_DIR=/stork/data/ai_biopsy/result/
AI_BIOPSY_TAG=latest
OUTPUT_DIR=~/Documents/2.GitHub/eipm/ai-biopsy/data/output/
UPLOAD_DIR=~/Documents/2.GitHub/eipm/ai-biopsy/data/uploads/
PROCESS_DIR=~/Documents/2.GitHub/eipm/ai-biopsy/data/process/
RESULT_DIR=~/Documents/2.GitHub/eipm/ai-biopsy/data/result/
docker run -d --name ${DOCKER_CONTAINER_NAME} \
--restart on-failure:5 \
-p ${AI_BIOPSY_PORT}:80 \
-v ${OUTPUT_DIR}:/output \
-v ${UPLOAD_DIR}:/uploads \
-v ${PROCESS_DIR}:/ai_biopsy/src/ai_biopsy_src/process/:ro \
-v ${RESULT_DIR}:/ai_biopsy/src/ai_biopsy_src/result/:ro \
--env USERS_DICT="{ 'user1': 'password1', 'user2': 'password2' }" \
eipm/ai-biopsy:${AI_BIOPSY_TAG}
Where:
Content type
Image
Digest
sha256:f3d9840e1…
Size
833.6 MB
Last updated
almost 3 years ago
docker pull eipm/ai-biopsy