COVID-Net工程源码详解(四) - train_eval_inference.md解析

docs/train_eval_inference.md内容如下:

# Training, Evaluation and Inference
The network takes as input an image of shape (N, 224, 224, 3) and outputs the softmax probabilities as (N, 3), where N is the number of batches.
If using the TF checkpoints, here are some useful tensors:

* input tensor: `input_1:0`
* logit tensor: `dense_3/MatMul:0`
* output tensor: `dense_3/Softmax:0`
* label tensor: `dense_3_target:0`
* class weights tensor: `dense_3_sample_weights:0`
* loss tensor: `loss/mul:0`

## Steps for training
TF training script from a pretrained model:
1. We provide you with the tensorflow evaluation script, [train_tf.py](../train_tf.py)
2. Locate the tensorflow checkpoint files (location of pretrained model)
3. To train from a pretrained model:
```
python train_tf.py \
    --weightspath models/COVIDNet-CXR-Large \
    --metaname model.meta \
    --ckptname model-8485
```
4. For more options and information, `python train_tf.py --help`

## Steps for evaluation

1. We provide you with the tensorflow evaluation script, [eval.py](../eval.py)
2. Locate the tensorflow checkpoint files
3. To evaluate a tf checkpoint:
```
python eval.py \
    --weightspath models/COVIDNet-CXR-Large \
    --metaname model.meta \
    --ckptname model-8485
```
4. For more options and information, `python eval.py --help`

## Steps for inference
**DISCLAIMER: Do not use this prediction for self-diagnosis. You should check with your local authorities for the latest advice on seeking medical assistance.**

1. Download a model from the [pretrained models section](models.md)
2. Locate models and xray image to be inferenced
3. To inference,
```
python inference.py \
    --weightspath models/COVIDNet-CXR-Large \
    --metaname model.meta_eval \
    --ckptname model-8485 \
    --imagepath assets/ex-covid.jpeg
```
4. For more options and information, `python inference.py --help`

## Steps for Training COVIDNet-Risk

COVIDNet-Risk uses the same architecture as the existing COVIDNet - but instead it predicts the *"number of days since symptom onset"\** for a diagnosed COVID-19 patient based on their chest radiography (same data as COVIDNet). By performing offset stratification, we aim to provide an estimate of prognosis for the patient. Note that the initial dataset is fairly small at the time of writing and we hope to see more results as data increases.

1. Complete data creation and training for COVIDNet (see Training above)
2. run `train_risknet.py` (see `-h` for argument help)

*\* note that definition varies between data sources*

# Training, Evaluation and Inference
The network takes as input an image of shape (N, 224, 224, 3) and outputs the softmax probabilities as (N, 3), where N is the number of batches.
If using the TF checkpoints, here are some useful tensors:

训练,评估和推断

网络以形状为(N,224,224,3)的图像作为输入,并且输出形状为(N,3)的softmax probabilities(3分类),N是batch的数量。

如果使用TF检查点,这是一些有用的张量:

* input tensor: `input_1:0`
* logit tensor: `dense_3/MatMul:0`
* output tensor: `dense_3/Softmax:0`
* label tensor: `dense_3_target:0`
* class weights tensor: `dense_3_sample_weights:0`
* loss tensor: `loss/mul:0`

输入张量:`input_1:0`

逻辑回归张量:`dense_3/MatMul:0`

输出张量:`dense_3/Softmax:0`

标签张量: `dense_3_target:0`

权重类张量:`dense_3_sample_weights:0`

损失张量: `loss/mul:0`

 

## Steps for training
TF training script from a pretrained model:
1. We provide you with the tensorflow evaluation script, [train_tf.py](../train_tf.py)
2. Locate the tensorflow checkpoint files (location of pretrained model)
3. To train from a pretrained model:
```
python train_tf.py \
    --weightspath models/COVIDNet-CXR-Large \
    --metaname model.meta \
    --ckptname model-8485
```

4. For more options and information, `python train_tf.py --help`

训练步骤

来自一个预训练模型的TF训练脚本:

1. 我们提供tensorflow评估脚本,[train_tf.py](../train_tf.py)

2. 定位tensorflow检查点文件(预训练模型的位置)

3. 利用预训练的模型进行训练(,运行以下命令):

python train_tf.py --weightspath models/COVIDNet-CXR-Large --metaname model.meta --ckptname model-8485

4. 了解更多选项和信息(,运行以下命令):

 python train_tf.py --help

 

## Steps for evaluation

1. We provide you with the tensorflow evaluation script, [eval.py](../eval.py)
2. Locate the tensorflow checkpoint files
3. To evaluate a tf checkpoint:
```
python eval.py \
    --weightspath models/COVIDNet-CXR-Large \
    --metaname model.meta \
    --ckptname model-8485
```
4. For more options and information, `python eval.py --help`

评估步骤

1. 我们提供tensorflow评估脚本, [eval.py](../eval.py)

2. 定位tensorflow检查点文件

3. 评估一个tf检查点(,运行以下命令):

python eval.py --weightspath models/COVIDNet-CXR-Large --metaname model.meta --ckptname model-8485

4.  了解更多选项和信息(,运行以下命令):

python eval.py --help

 

## Steps for inference
**DISCLAIMER: Do not use this prediction for self-diagnosis. You should check with your local authorities for the latest advice on seeking medical assistance.**

1. Download a model from the [pretrained models section](models.md)
2. Locate models and xray image to be inferenced
3. To inference,
```
python inference.py \
    --weightspath models/COVIDNet-CXR-Large \
    --metaname model.meta_eval \
    --ckptname model-8485 \
    --imagepath assets/ex-covid.jpeg
```
4. For more options and information, `python inference.py --help`

推断步骤

免责声明:不要使用这个预测作自诊断。你应该向当地有关主管部门寻求医疗援助。

1. 从预训练模型段下载模型(models.md)

2. 定位要推断的模型和X光图像

3. 推断(,运行以下命令)

python inference.py --weightspath models/COVIDNet-CXR-Large --metaname model.meta_eval --ckptname model-8485 --imagepath assets/ex-covid.jpeg

4.  了解更多选项和信息(,运行以下命令):

python inference.py --help

 

## Steps for Training COVIDNet-Risk

COVIDNet-Risk uses the same architecture as the existing COVIDNet - but instead it predicts the *"number of days since symptom onset"\** for a diagnosed COVID-19 patient based on their chest radiography (same data as COVIDNet). By performing offset stratification, we aim to provide an estimate of prognosis for the patient. Note that the initial dataset is fairly small at the time of writing and we hope to see more results as data increases.

1. Complete data creation and training for COVIDNet (see Training above)
2. run `train_risknet.py` (see `-h` for argument help)

*\* note that definition varies between data sources*
训练COVIDNet-Risk步骤

COVIDNet-Risk使用与既有的COVIDNet同样的架构 - 但是它预测一个COVID-19确诊病例自症状发作起的天数,基于他们的胸部X光(与COVIDNet同样的数据集)。通过执行偏移分层,我们旨在给出一个病人预后的估计。注意,初始的数据集是相当小的,我们希望随着数据不断增加,能看到更多结果。

1. 完成COVIDNet的数据构建和训练(见上边训练部分)

2. 运行train_risknet.py(参数说明通过-h选项查看)

注意:不同数据源的定义不同。

你可能感兴趣的:(COVID9,AI,TensorFlow)