Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging trk #242

Merged
merged 40 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a92f859
added new files
Jan 25, 2024
286be0e
Merge remote-tracking branch 'origin/main' into merge_rtk
Sep 20, 2024
1f73708
add files & fixes
Sep 20, 2024
6b1c3d1
fix
Oct 2, 2024
028fe2f
activ sigmoid
Oct 4, 2024
9c65318
infer for lungs
Oct 17, 2024
087d07c
tests
Oct 22, 2024
84d9364
models uploaded, code readability
Oct 22, 2024
21142d4
hemor_contrast old recover 1
Dec 4, 2024
f9b0ebf
hemor_contrast old recover 2
Dec 7, 2024
4f43a30
revert old test changes
Dec 7, 2024
1530c89
refactor rtk to new files
Dec 7, 2024
786ba64
restore old coco files
Dec 7, 2024
a4b1000
restore old test file
Dec 7, 2024
9881d70
rename experiments
Dec 7, 2024
b8219c7
Merge remote-tracking branch 'origin/main' into merging_trk
Dec 8, 2024
7bc0a26
lung description check
Dec 8, 2024
a2a160c
fix tests
Dec 10, 2024
8d2af61
fix tests
Dec 11, 2024
9ce6c6a
tests removed
Dec 12, 2024
dfe5bba
float comparison in tests
Dec 12, 2024
482ef38
remove selfwritten iou
Dec 12, 2024
7181c48
Merge branch 'main' into merging_trk
BarzaH Dec 12, 2024
619dc73
get test back
Dec 15, 2024
c7747fb
Merge remote-tracking branch 'origin/main' into merging_trk
Dec 15, 2024
4e06c4d
Merge remote-tracking branch 'origin/merging_trk' into merging_trk
Dec 15, 2024
1b32229
black
Dec 15, 2024
5893919
an attempt to pass tests
Dec 15, 2024
e14126e
an attempt to pass tests
Dec 16, 2024
af10597
test back
Dec 16, 2024
edb6475
Fixed gdcm error
BarzaH Dec 17, 2024
fdc534e
Merge remote-tracking branch 'origin/merging_trk' into merging_trk
BarzaH Dec 17, 2024
2c7221e
Fixed gdcm error
BarzaH Dec 17, 2024
b9938e0
fix path bug
Dec 18, 2024
cdb7f89
merge Ibragim changes
Dec 18, 2024
4705c0b
more tests
Dec 18, 2024
a4bce08
fixes and more tests
Dec 19, 2024
8295047
argparse tests
Dec 20, 2024
48eddd2
tests more
Dec 20, 2024
917d440
remove redund comments
Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ markup_info: Набор данных содержит описание легк
date_time: 13.09.2023

_target_: innofw.core.datamodules.pandas_datamodules.lung_description_decision_datamodule.LungDescriptionDecisionPandasDataModule
target_col: decision
target_col: "decision"

train:
source: ./data/ainur/infer/labels.csv
source: https://api.blackhole.ai.innopolis.university/public-datasets/rtk/labels.zip
target: ./data/lung_description/train
test:
source: ./data/ainur/infer/labels.csv
source: https://api.blackhole.ai.innopolis.university/public-datasets/rtk/labels.zip
target: ./data/lung_description/test
infer:
source: ./data/ainur/infer/labels.csv

source: https://api.blackhole.ai.innopolis.university/public-datasets/rtk/labels.zip
target: ./data/lung_description/infer

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
_target_: innofw.core.datamodules.lightning_datamodules.coco_rtk.DicomCocoComplexingDataModule
date_time: 30.09.2022
description: stroke segmentation dataset
markup_info: segmentation masks
name: stroke segmentation
task:
- image-segmentation

test:
source: https://api.blackhole.ai.innopolis.university/public-datasets/stroke/test.zip
target: ./data/stroke/test
train:
source: https://api.blackhole.ai.innopolis.university/public-datasets/stroke/train.zip
target: ./data/stroke/train
infer:
source: https://api.blackhole.ai.innopolis.university/public-datasets/rtk/complex_infer.zip
target: ./data/complex/infer
17 changes: 17 additions & 0 deletions config/datasets/semantic-segmentation/segmentation_brain_rtk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
_target_: innofw.core.datamodules.lightning_datamodules.coco_rtk.DicomCocoDataModuleRTK
date_time: 30.09.2022
description: stroke segmentation dataset
markup_info: segmentation masks
name: stroke segmentation
task:
- image-segmentation

test:
source: https://api.blackhole.ai.innopolis.university/public-datasets/stroke/test.zip
target: ./data/rtk/test
train:
source: https://api.blackhole.ai.innopolis.university/public-datasets/stroke/train.zip
target: ./data/rtk/train
infer:
source: https://api.blackhole.ai.innopolis.university/public-datasets/rtk/infer.zip
target: ./data/rtk/infer
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @package _global_
defaults:
- override /models: semantic-segmentation/unet_brain
- override /datasets: semantic-segmentation/segmentation_brain_complex.yaml
- override /augmentations_train: none #segmentation_stroke.yaml
- override /augmentations_val: none
- override /augmentations_test: none
- override /losses: segmentation_losses.yaml
models:
in_channels: 1
project: "segmentation"
task: "image-segmentation"
random_seed: 42
stop_param: 10
epochs: 300
weights_freq: 1
batch_size: 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @package _global_
defaults:
- override /models: semantic-segmentation/unet_brain
- override /datasets: semantic-segmentation/segmentation_brain_rtk.yaml
- override /augmentations_train: none #segmentation_stroke.yaml
- override /augmentations_val: none
- override /augmentations_test: none
- override /losses: segmentation_losses.yaml
models:
in_channels: 1
project: "segmentation"
task: "image-segmentation"
random_seed: 42
stop_param: 10
epochs: 300
weights_freq: 1
batch_size: 10
4 changes: 2 additions & 2 deletions config/models/classification/lung_description_decision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ steps:
- - "vectorizer"
- _target_: sklearn.feature_extraction.text.TfidfVectorizer
max_df: 1000
stop_words:
- russian
# stop_words:
# - russian
min_df: 10
- - "classifier"
- _target_: sklearn.linear_model.LogisticRegression
Expand Down
8 changes: 8 additions & 0 deletions config/models/semantic-segmentation/unet_brain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_target_: segmentation_models_pytorch.FPN
description: Base Unet segmentation model with 1 channel input
name: FPN
in_channels: 1
classes: 4
encoder_name: 'efficientnet-b7'
encoder_weights:
activation: sigmoid
10 changes: 9 additions & 1 deletion examples/infer_contrasting_ct_dicom_brain.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
python3 ./innofw/utils/data_utils/preprocessing/CT_hemorrhage_contrast.py
data_path=$1
out_path=$2

if [ -z "$data_path" ]; then
data_path="https://api.blackhole.ai.innopolis.university/public-datasets/rtk/infer.zip"
echo "Using default data path $data_path"
fi

python innofw/utils/data_utils/preprocessing/CT_hemorrhage_contrast_rtk.py --input "$data_path" --output "$out_path"
14 changes: 13 additions & 1 deletion examples/infer_ct_brain_hemorrhage_detection.sh
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
python infer.py experiments=semantic-segmentation/SK_180822_qmciwj41_unet_brain 'ckpt_path=https://api.blackhole.ai.innopolis.university/pretrained/segmentation_unet_brain.pt'
data_path=$1
experiments="semantic-segmentation/AK_081224_gwVOeQ_unet_brain_rtk"
ckpt_path="https://api.blackhole.ai.innopolis.university/pretrained/segmentation_rtk_brain.pt"
if [ -z "$data_path" ]
then
python infer.py experiments=$experiments \
"ckpt_path=$ckpt_path"
else
python infer.py experiments=$experiments \
"ckpt_path=$ckpt_path" \
"++datasets.infer.target='$data_path'" \
"++datasets.infer.source='$data_path'"
fi
15 changes: 14 additions & 1 deletion examples/infer_ct_brain_hemorrhage_segmentation.sh
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
python infer.py experiments=semantic-segmentation/SK_180822_qmciwj41_unet_brain 'ckpt_path=https://api.blackhole.ai.innopolis.university/pretrained/segmentation_unet_brain.pt'
data_path=$1
experiments="semantic-segmentation/AK_081224_gwVOeQ_unet_brain_rtk"
ckpt_path="https://api.blackhole.ai.innopolis.university/pretrained/segmentation_rtk_brain.pt"

if [ -z "$data_path" ]
then
python infer.py experiments=$experiments \
"ckpt_path=$ckpt_path"
else
python infer.py experiments=$experiments \
"ckpt_path=$ckpt_path" \
"++datasets.infer.target='$data_path'" \
"++datasets.infer.source='$data_path'"
fi
14 changes: 13 additions & 1 deletion examples/infer_ct_mri_complexing.sh
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
python infer.py experiments=semantic-segmentation/SK_100923_uner_brain_mri.yaml 'ckpt_path=https://api.blackhole.ai.innopolis.university/pretrained/segmentation_unet_brain_complex.pt'
data_path=$1
ckpt_path="https://api.blackhole.ai.innopolis.university/pretrained/segmentation_rtk_brain.pt"
experiments="semantic-segmentation/AK_081224_Yjc97FX_unet_brain_complex.yaml"

if [ -z "$data_path" ]
then
python infer.py experiments=$experiments \
"ckpt_path=$ckpt_path"
else
python infer.py experiments=$experiments \
"++datasets.infer.source='$data_path'" \
"ckpt_path=$ckpt_path"
fi
2 changes: 1 addition & 1 deletion examples/infer_lung_description_decision.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export HYDRA_FULL_ERROR=1
export experiments="classification/AK_130923_fbFMFDe1_lung_description_decision.yaml"
export model_weights="/home/ainur/Desktop/innopolis/text/pipe.pkl"
export model_weights="https://api.blackhole.ai.innopolis.university/pretrained/lungs_description.pkl"
export data_source=$1
if [ -z "$data_source" ]
then
Expand Down
7 changes: 7 additions & 0 deletions examples/metrics_contrasting_ct_dicom_brain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output=$1
if [ -z "$output" ]; then
output="../innofw/logs/infer/contrast"
output+="/$(ls $output -tr | tail -n 1)"
output+="/$(ls $output -tr | tail -n 1)"
fi
python innofw/utils/data_utils/preprocessing/CT_hemorrhage_contrast_metrics.py -o "$output"
14 changes: 14 additions & 0 deletions examples/metrics_ct_brain_hemorrhage_detection.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
data_path=$1
out=$2
if [ -z "$data_path" ]; then
data_path="../innofw/data/rtk/infer/"
echo "Using default data path $data_path"
fi

if [ -z "$output" ]; then
output="../innofw/logs/infer/segmentation/semantic-segmentation/AK_081224_gwVOeQ_unet_brain_rtk/"
output+="$(ls $output | tail -n 1)"
echo "Using default output path $output"
fi

python innofw/utils/data_utils/rtk/CT_hemorrhage_metrics.py -i "$data_path" -o "$output" -t "detection"
14 changes: 14 additions & 0 deletions examples/metrics_ct_brain_hemorrhage_segmentation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
data_path=$1
output=$2
if [ -z "$data_path" ]; then
data_path="../innofw/data/rtk/infer/"
echo "Using default data path $data_path"
fi

if [ -z "$output" ]; then
output="../innofw/logs/infer/segmentation/semantic-segmentation/AK_081224_gwVOeQ_unet_brain_rtk/"
output+="$(ls $output -tr| tail -n 1)"
echo "Using default output path $output"
fi

python innofw/utils/data_utils/rtk/CT_hemorrhage_metrics.py -i "$data_path" -o "$output" -t "segmentation"
13 changes: 13 additions & 0 deletions examples/metrics_ct_mri_complexing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
data_path=$1
output=$2

if [ -z "$data_path" ]; then
data_path="../innofw/data/complex/infer"
echo "Using default data path $data_path"
fi

if [ -z "$output" ]; then
output="../innofw/logs/infer/segmentation/semantic-segmentation/AK_081224_Yjc97FX_unet_brain_complex.yaml/"
output+="$(ls $output -tr | tail -n 1)"
fi
python innofw/utils/data_utils/rtk/CT_complexing_metrics.py -i $data_path -o $output
14 changes: 14 additions & 0 deletions examples/metrics_lung_description_decision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
data_path=$1
if [ -z "$data_path" ]; then
data_path="./data/lung_description/infer/labels.csv"
echo "Using default data path $data_path"
fi

if [ -z "$output" ]; then
output="./logs/infer/lung_description_decision/classification/AK_130923_fbFMFDe1_lung_description_decision.yaml/"
output+="$(ls $output -tr| tail -n 1)/"
output+="$(ls $output -tr| tail -n 1)"
echo "Using default output path $output"
fi

python innofw/utils/data_utils/rtk/lungs_description_metrics.py -i "$data_path" -o "$output"
Loading