commit 31770491edf961ba68a49778d3389506c876b1f6 Author: deng Date: Tue Sep 19 20:54:19 2023 +0800 init diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..44ce80b Binary files /dev/null and b/.DS_Store differ diff --git a/Q1/.DS_Store b/Q1/.DS_Store new file mode 100644 index 0000000..79ce44a Binary files /dev/null and b/Q1/.DS_Store differ diff --git a/Q1/HandBoneXRay/022daabc3f37b1f0300dc176d8c736bd2c0908cf113cc56a90e114a00d2d083c.dcm b/Q1/HandBoneXRay/022daabc3f37b1f0300dc176d8c736bd2c0908cf113cc56a90e114a00d2d083c.dcm new file mode 100644 index 0000000..635e7b9 Binary files /dev/null and b/Q1/HandBoneXRay/022daabc3f37b1f0300dc176d8c736bd2c0908cf113cc56a90e114a00d2d083c.dcm differ diff --git a/Q1/HandBoneXRay/14b69cd0fc6062b66384c2ad5725a2763f0336b3fc0991e3762dbb3384ec4543.dcm b/Q1/HandBoneXRay/14b69cd0fc6062b66384c2ad5725a2763f0336b3fc0991e3762dbb3384ec4543.dcm new file mode 100644 index 0000000..b01f4f4 Binary files /dev/null and b/Q1/HandBoneXRay/14b69cd0fc6062b66384c2ad5725a2763f0336b3fc0991e3762dbb3384ec4543.dcm differ diff --git a/Q1/HandBoneXRay/18c5f17b29fdb47313fe54c59d44bc658939d0fc1b5df43f449e9ce13e5aeee0.dcm b/Q1/HandBoneXRay/18c5f17b29fdb47313fe54c59d44bc658939d0fc1b5df43f449e9ce13e5aeee0.dcm new file mode 100644 index 0000000..25dbd16 Binary files /dev/null and b/Q1/HandBoneXRay/18c5f17b29fdb47313fe54c59d44bc658939d0fc1b5df43f449e9ce13e5aeee0.dcm differ diff --git a/Q1/HandBoneXRay/20af6f6a6a6c7a93fe85443a9505ef62c9a26c3e873af55345c7108b6d19a18e.dcm b/Q1/HandBoneXRay/20af6f6a6a6c7a93fe85443a9505ef62c9a26c3e873af55345c7108b6d19a18e.dcm new file mode 100644 index 0000000..e294f9e Binary files /dev/null and b/Q1/HandBoneXRay/20af6f6a6a6c7a93fe85443a9505ef62c9a26c3e873af55345c7108b6d19a18e.dcm differ diff --git a/Q1/HandBoneXRay/22b63b2c78bc96711c0af031585f327874f56f18a5f42a6a7f004b8ce4a8ed26.dcm b/Q1/HandBoneXRay/22b63b2c78bc96711c0af031585f327874f56f18a5f42a6a7f004b8ce4a8ed26.dcm new file mode 100644 index 0000000..2e2c951 Binary files /dev/null and b/Q1/HandBoneXRay/22b63b2c78bc96711c0af031585f327874f56f18a5f42a6a7f004b8ce4a8ed26.dcm differ diff --git a/Q1/HandBoneXRay/8c91810dc0a287cfd44d4933a1830ff8f836176e7de842607f8dcd7a291469e4.dcm b/Q1/HandBoneXRay/8c91810dc0a287cfd44d4933a1830ff8f836176e7de842607f8dcd7a291469e4.dcm new file mode 100644 index 0000000..13c1c64 Binary files /dev/null and b/Q1/HandBoneXRay/8c91810dc0a287cfd44d4933a1830ff8f836176e7de842607f8dcd7a291469e4.dcm differ diff --git a/Q1/HandBoneXRay/9bc2cc3f5c945c1ef384ceb083f67c85a75981b5c854e7f687a806ad48298219.dcm b/Q1/HandBoneXRay/9bc2cc3f5c945c1ef384ceb083f67c85a75981b5c854e7f687a806ad48298219.dcm new file mode 100644 index 0000000..dada359 Binary files /dev/null and b/Q1/HandBoneXRay/9bc2cc3f5c945c1ef384ceb083f67c85a75981b5c854e7f687a806ad48298219.dcm differ diff --git a/Q1/HandBoneXRay/9c3bca9bcba9699e2885113213cb9c99a35f4bd37983fa550530334454e339e5.dcm b/Q1/HandBoneXRay/9c3bca9bcba9699e2885113213cb9c99a35f4bd37983fa550530334454e339e5.dcm new file mode 100644 index 0000000..b2cdded Binary files /dev/null and b/Q1/HandBoneXRay/9c3bca9bcba9699e2885113213cb9c99a35f4bd37983fa550530334454e339e5.dcm differ diff --git a/Q1/HandBoneXRay/9ce18cd89a593fd53e96b90849ae94a7e486fcddc3bd73d92d102ff06731df62.dcm b/Q1/HandBoneXRay/9ce18cd89a593fd53e96b90849ae94a7e486fcddc3bd73d92d102ff06731df62.dcm new file mode 100644 index 0000000..b0d643c Binary files /dev/null and b/Q1/HandBoneXRay/9ce18cd89a593fd53e96b90849ae94a7e486fcddc3bd73d92d102ff06731df62.dcm differ diff --git a/Q1/HandBoneXRay/9d90bc111733ddf933f5393723ccd360c5d015ee45e41962dc193c1a93de137d.dcm b/Q1/HandBoneXRay/9d90bc111733ddf933f5393723ccd360c5d015ee45e41962dc193c1a93de137d.dcm new file mode 100644 index 0000000..7144b2f Binary files /dev/null and b/Q1/HandBoneXRay/9d90bc111733ddf933f5393723ccd360c5d015ee45e41962dc193c1a93de137d.dcm differ diff --git a/Q1/code.py b/Q1/code.py new file mode 100644 index 0000000..09ef547 --- /dev/null +++ b/Q1/code.py @@ -0,0 +1,97 @@ +# code.py +# This is an image preprocessing code for HandBoneXRay data, please adopt env.yaml to +# create conda env to run this script +# +# author : deng +# date : 20230919 +# platform: MacBook Pro 14 2021 + +import os +from shutil import rmtree + +import cv2 +import pydicom +import numpy as np +import matplotlib.pyplot as plt + + +if __name__ == '__main__': + + xray_dir = 'HandBoneXRay/' + result_dir = 'results' + plot = False + + # Create result dir to save processed images + if os.path.isdir(result_dir): + rmtree(result_dir) + os.makedirs(result_dir) + + # Get xray dicom paths + dicom_paths = [os.path.join(xray_dir, file_name) + for file_name in os.listdir(xray_dir) + if file_name.endswith('dcm')] + + for dicom_path in dicom_paths: + print(f'Start to process {dicom_path}') + + # Read image + ds = pydicom.dcmread(dicom_path) + pixel_array = ds.pixel_array + orig_pixel_array = pixel_array.copy() + if plot: + plt.title('Raw image') + plt.imshow(pixel_array, cmap='gray') + plt.show() + + # Thresholding + pixel_array[pixel_array < 1] = 0 + pixel_array[pixel_array >= 1] = 1 + pixel_array = pixel_array.astype(np.uint8) + if plot: + plt.title('Thresholding') + plt.imshow(pixel_array, cmap='gray') + plt.show() + + # Calculate rotation angle by minAreaRect method + contours, _ = cv2.findContours(pixel_array, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) + contour_w_max_area = max(contours, key = cv2.contourArea) + rect = cv2.minAreaRect(contour_w_max_area) + angle = rect[2] + if angle > 45: + angle -= 90 + + # Rotate image + h, w = orig_pixel_array.shape[:2] + center = rect[0] + matrix = cv2.getRotationMatrix2D(center, angle, 1.0) + rotated = cv2.warpAffine(orig_pixel_array, matrix, (w, h), flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_CONSTANT) + if plot: + plt.title('Rotated image') + plt.imshow(rotated, cmap='gray') + plt.show() + + # Crop edge + xs, ys = np.nonzero(rotated) + x_min,x_max = xs.min(), xs.max() + y_min, y_max = ys.min(), ys.max() + cropped = rotated[x_min:x_max+1, y_min:y_max+1] + cropped = cropped.astype(np.uint16) + if plot: + plt.title('Cropped image') + plt.imshow(cropped, cmap='gray') + plt.show() + + # Save it + save_path = os.path.join(result_dir, os.path.basename(dicom_path)) + ds.PixelData = cropped + ds.Rows = cropped.shape[0] + ds.Columns = cropped.shape[1] + pydicom.filewriter.dcmwrite(save_path, ds) + if plot: + ds = pydicom.dcmread(save_path) + pixel_array = ds.pixel_array + plt.title('Saved image') + plt.imshow(pixel_array, cmap='gray') + plt.show() + + print('done.') \ No newline at end of file diff --git a/Q1/env.yaml b/Q1/env.yaml new file mode 100644 index 0000000..9126499 --- /dev/null +++ b/Q1/env.yaml @@ -0,0 +1,134 @@ +name: Q1 +channels: + - conda-forge +dependencies: + - aom=3.5.0 + - brotli=1.1.0 + - brotli-bin=1.1.0 + - bzip2=1.0.8 + - c-ares=1.19.1 + - ca-certificates=2023.7.22 + - cairo=1.16.0 + - certifi=2023.7.22 + - contourpy=1.1.1 + - cycler=0.11.0 + - dav1d=1.2.1 + - expat=2.5.0 + - ffmpeg=6.0.0 + - font-ttf-dejavu-sans-mono=2.37 + - font-ttf-inconsolata=3.000 + - font-ttf-source-code-pro=2.038 + - font-ttf-ubuntu=0.83 + - fontconfig=2.14.2 + - fonts-conda-ecosystem=1 + - fonts-conda-forge=1 + - fonttools=4.42.1 + - freetype=2.12.1 + - fribidi=1.0.10 + - gettext=0.21.1 + - gmp=6.2.1 + - gnutls=3.7.8 + - graphite2=1.3.13 + - harfbuzz=8.2.0 + - hdf5=1.14.2 + - icu=73.2 + - jasper=4.0.0 + - kiwisolver=1.4.5 + - krb5=1.21.2 + - lame=3.100 + - lcms2=2.15 + - lerc=4.0.0 + - libabseil=20230802.1 + - libaec=1.0.6 + - libass=0.17.1 + - libblas=3.9.0 + - libbrotlicommon=1.1.0 + - libbrotlidec=1.1.0 + - libbrotlienc=1.1.0 + - libcblas=3.9.0 + - libcurl=8.3.0 + - libcxx=16.0.6 + - libdeflate=1.19 + - libedit=3.1.20191231 + - libev=4.33 + - libexpat=2.5.0 + - libffi=3.4.2 + - libgfortran=5.0.0 + - libgfortran5=13.2.0 + - libglib=2.78.0 + - libiconv=1.17 + - libidn2=2.3.4 + - libjpeg-turbo=2.1.5.1 + - liblapack=3.9.0 + - liblapacke=3.9.0 + - libnghttp2=1.52.0 + - libopenblas=0.3.24 + - libopencv=4.8.0 + - libopenvino=2023.0.2 + - libopenvino-arm-cpu-plugin=2023.0.2 + - libopenvino-auto-batch-plugin=2023.0.2 + - libopenvino-auto-plugin=2023.0.2 + - libopenvino-hetero-plugin=2023.0.2 + - libopenvino-ir-frontend=2023.0.2 + - libopenvino-onnx-frontend=2023.0.2 + - libopenvino-paddle-frontend=2023.0.2 + - libopenvino-pytorch-frontend=2023.0.2 + - libopenvino-tensorflow-frontend=2023.0.2 + - libopenvino-tensorflow-lite-frontend=2023.0.2 + - libopus=1.3.1 + - libpng=1.6.39 + - libprotobuf=4.23.4 + - libsqlite=3.43.0 + - libssh2=1.11.0 + - libtasn1=4.19.0 + - libtiff=4.6.0 + - libunistring=0.9.10 + - libvpx=1.13.0 + - libwebp-base=1.3.2 + - libxcb=1.15 + - libxml2=2.11.5 + - libzlib=1.2.13 + - llvm-openmp=16.0.6 + - matplotlib=3.8.0 + - matplotlib-base=3.8.0 + - munkres=1.1.4 + - ncurses=6.4 + - nettle=3.8.1 + - numpy=1.26.0 + - opencv=4.8.0 + - openh264=2.3.1 + - openjpeg=2.5.0 + - openssl=3.1.2 + - p11-kit=0.24.1 + - packaging=23.1 + - pcre2=10.40 + - pillow=10.0.1 + - pip=23.2.1 + - pixman=0.40.0 + - pthread-stubs=0.4 + - pugixml=1.13 + - py-opencv=4.8.0 + - pydicom=2.4.3 + - pyparsing=3.1.1 + - python=3.10.12 + - python-dateutil=2.8.2 + - python_abi=3.10 + - readline=8.2 + - setuptools=68.2.2 + - six=1.16.0 + - snappy=1.1.10 + - svt-av1=1.7.0 + - tbb=2021.10.0 + - tk=8.6.12 + - tornado=6.3.3 + - tzdata=2023c + - unicodedata2=15.0.0 + - wheel=0.41.2 + - x264=1!164.3095 + - x265=3.5 + - xorg-libxau=1.0.11 + - xorg-libxdmcp=1.1.3 + - xz=5.2.6 + - zlib=1.2.13 + - zstd=1.5.5 +prefix: /Users/xiao_deng/miniforge3/envs/Q1 diff --git a/Q1/results/022daabc3f37b1f0300dc176d8c736bd2c0908cf113cc56a90e114a00d2d083c.dcm b/Q1/results/022daabc3f37b1f0300dc176d8c736bd2c0908cf113cc56a90e114a00d2d083c.dcm new file mode 100644 index 0000000..b546264 Binary files /dev/null and b/Q1/results/022daabc3f37b1f0300dc176d8c736bd2c0908cf113cc56a90e114a00d2d083c.dcm differ diff --git a/Q1/results/14b69cd0fc6062b66384c2ad5725a2763f0336b3fc0991e3762dbb3384ec4543.dcm b/Q1/results/14b69cd0fc6062b66384c2ad5725a2763f0336b3fc0991e3762dbb3384ec4543.dcm new file mode 100644 index 0000000..603c78e Binary files /dev/null and b/Q1/results/14b69cd0fc6062b66384c2ad5725a2763f0336b3fc0991e3762dbb3384ec4543.dcm differ diff --git a/Q1/results/18c5f17b29fdb47313fe54c59d44bc658939d0fc1b5df43f449e9ce13e5aeee0.dcm b/Q1/results/18c5f17b29fdb47313fe54c59d44bc658939d0fc1b5df43f449e9ce13e5aeee0.dcm new file mode 100644 index 0000000..e62f3b0 Binary files /dev/null and b/Q1/results/18c5f17b29fdb47313fe54c59d44bc658939d0fc1b5df43f449e9ce13e5aeee0.dcm differ diff --git a/Q1/results/20af6f6a6a6c7a93fe85443a9505ef62c9a26c3e873af55345c7108b6d19a18e.dcm b/Q1/results/20af6f6a6a6c7a93fe85443a9505ef62c9a26c3e873af55345c7108b6d19a18e.dcm new file mode 100644 index 0000000..efffcd9 Binary files /dev/null and b/Q1/results/20af6f6a6a6c7a93fe85443a9505ef62c9a26c3e873af55345c7108b6d19a18e.dcm differ diff --git a/Q1/results/22b63b2c78bc96711c0af031585f327874f56f18a5f42a6a7f004b8ce4a8ed26.dcm b/Q1/results/22b63b2c78bc96711c0af031585f327874f56f18a5f42a6a7f004b8ce4a8ed26.dcm new file mode 100644 index 0000000..0f02407 Binary files /dev/null and b/Q1/results/22b63b2c78bc96711c0af031585f327874f56f18a5f42a6a7f004b8ce4a8ed26.dcm differ diff --git a/Q1/results/8c91810dc0a287cfd44d4933a1830ff8f836176e7de842607f8dcd7a291469e4.dcm b/Q1/results/8c91810dc0a287cfd44d4933a1830ff8f836176e7de842607f8dcd7a291469e4.dcm new file mode 100644 index 0000000..2b42c0c Binary files /dev/null and b/Q1/results/8c91810dc0a287cfd44d4933a1830ff8f836176e7de842607f8dcd7a291469e4.dcm differ diff --git a/Q1/results/9bc2cc3f5c945c1ef384ceb083f67c85a75981b5c854e7f687a806ad48298219.dcm b/Q1/results/9bc2cc3f5c945c1ef384ceb083f67c85a75981b5c854e7f687a806ad48298219.dcm new file mode 100644 index 0000000..456e266 Binary files /dev/null and b/Q1/results/9bc2cc3f5c945c1ef384ceb083f67c85a75981b5c854e7f687a806ad48298219.dcm differ diff --git a/Q1/results/9c3bca9bcba9699e2885113213cb9c99a35f4bd37983fa550530334454e339e5.dcm b/Q1/results/9c3bca9bcba9699e2885113213cb9c99a35f4bd37983fa550530334454e339e5.dcm new file mode 100644 index 0000000..e728f93 Binary files /dev/null and b/Q1/results/9c3bca9bcba9699e2885113213cb9c99a35f4bd37983fa550530334454e339e5.dcm differ diff --git a/Q1/results/9ce18cd89a593fd53e96b90849ae94a7e486fcddc3bd73d92d102ff06731df62.dcm b/Q1/results/9ce18cd89a593fd53e96b90849ae94a7e486fcddc3bd73d92d102ff06731df62.dcm new file mode 100644 index 0000000..64fc2e6 Binary files /dev/null and b/Q1/results/9ce18cd89a593fd53e96b90849ae94a7e486fcddc3bd73d92d102ff06731df62.dcm differ diff --git a/Q1/results/9d90bc111733ddf933f5393723ccd360c5d015ee45e41962dc193c1a93de137d.dcm b/Q1/results/9d90bc111733ddf933f5393723ccd360c5d015ee45e41962dc193c1a93de137d.dcm new file mode 100644 index 0000000..af37152 Binary files /dev/null and b/Q1/results/9d90bc111733ddf933f5393723ccd360c5d015ee45e41962dc193c1a93de137d.dcm differ diff --git a/Q2/code.py b/Q2/code.py new file mode 100644 index 0000000..b857990 --- /dev/null +++ b/Q2/code.py @@ -0,0 +1,63 @@ +# code.py +# Please use env.yaml to build corresponding conda env if you want to run this script +# +# author : deng +# date : 20230919 +# platform: MacBook Pro 14 2021 + +VALID_CHARS = ['T', 'F', 'O', 'A', '(', ')'] +CAL_DICT = { + 'T': 'T', + 'F': 'F', + 'TAT': 'T', + 'TAF': 'F', + 'FAT': 'F', + 'FAF': 'F', + 'TOT': 'T', + 'TOF': 'T', + 'FOT': 'T', + 'FOF': 'F' +} + + +def log_cal(exp: str) -> str: + while True: + if exp in CAL_DICT: + return CAL_DICT[exp] + else: + try: + exp = CAL_DICT[exp[:3]] + exp[3:] + except KeyError: + return 'E' + + +def bool_exp(exp: str) -> str: + stack = [] + + for char in exp: + if char not in VALID_CHARS: + return 'E' + if char == ')': + sub_exp = '' + while True: + try: + val = stack.pop() + if val == '(': + break + sub_exp = val + sub_exp + except IndexError: + return 'E' + cal_exp = log_cal(sub_exp) + if cal_exp == 'E': + return 'E' + stack.append(cal_exp) + else: + stack.append(char) + + return log_cal(''.join(stack)) + + +if __name__ == '__main__': + + exp = input('Please input expression:').upper() + print(bool_exp(exp)) diff --git a/Q2/env.yaml b/Q2/env.yaml new file mode 100644 index 0000000..c8ff95f --- /dev/null +++ b/Q2/env.yaml @@ -0,0 +1,20 @@ +name: Q2 +channels: + - conda-forge +dependencies: + - bzip2=1.0.8 + - ca-certificates=2023.7.22 + - libffi=3.4.2 + - libsqlite=3.43.0 + - libzlib=1.2.13 + - ncurses=6.4 + - openssl=3.1.2 + - pip=23.2.1 + - python=3.10.12 + - readline=8.2 + - setuptools=68.2.2 + - tk=8.6.12 + - tzdata=2023c + - wheel=0.41.2 + - xz=5.2.6 +prefix: /Users/xiao_deng/miniforge3/envs/Q2 diff --git a/Q3/.DS_Store b/Q3/.DS_Store new file mode 100644 index 0000000..bb6f270 Binary files /dev/null and b/Q3/.DS_Store differ diff --git a/Q3/code.py b/Q3/code.py new file mode 100644 index 0000000..0e08987 --- /dev/null +++ b/Q3/code.py @@ -0,0 +1,52 @@ +# code.py +# Please use env.yaml to build corresponding conda env if you want to run this script +# +# author : deng +# date : 20230919 +# platform: MacBook Pro 14 2021 + +import pandas +from sklearn import metrics +import matplotlib.pyplot as plt + + +if __name__ == '__main__': + + csv_path = 'psudo_result.csv' + df = pandas.read_csv(csv_path) + df = df[:-1] + + # Quick glance + print('Ground truth') + print(df['Ground truth'].value_counts()) + print('Gender') + print(df['Gender'].value_counts()) + print('Age') + plt.title('All patients') + plt.xlabel('age') + plt.ylabel('count') + df['Age'].hist(bins=20) + plt.show() + plt.title('Sick patients') + plt.xlabel('age') + plt.ylabel('count') + df[df['Ground truth'] == 'Sick']['Age'].hist(bins=20) + plt.show() + + # Confusion Matrix + # threshold = 0.5 + # gt = df['Ground truth'] + # pred = ['Sick' if val >= threshold else 'No Sick' + # for val in df['AI pred']] + # print(metrics.classification_report(gt, pred)) + + # ROC curve + gt = [1 if val == 'Sick' else 0 + for val in df['Ground truth']] + pred = df['AI pred'] + fpr, tpr, thresholds = metrics.roc_curve(gt, pred, pos_label=1) + plt.title('ROC curve') + plt.plot(fpr, tpr) + plt.ylabel('True Positive Rate') + plt.xlabel('False Positive Rate') + plt.show() diff --git a/Q3/env.yaml b/Q3/env.yaml new file mode 100644 index 0000000..db4d1f9 --- /dev/null +++ b/Q3/env.yaml @@ -0,0 +1,71 @@ +name: Q3 +channels: + - conda-forge +dependencies: + - brotli=1.1.0 + - brotli-bin=1.1.0 + - bzip2=1.0.8 + - ca-certificates=2023.7.22 + - certifi=2023.7.22 + - contourpy=1.1.1 + - cycler=0.11.0 + - fonttools=4.42.1 + - freetype=2.12.1 + - joblib=1.3.2 + - kiwisolver=1.4.5 + - lcms2=2.15 + - lerc=4.0.0 + - libblas=3.9.0 + - libbrotlicommon=1.1.0 + - libbrotlidec=1.1.0 + - libbrotlienc=1.1.0 + - libcblas=3.9.0 + - libcxx=16.0.6 + - libdeflate=1.19 + - libffi=3.4.2 + - libgfortran=5.0.0 + - libgfortran5=13.2.0 + - libjpeg-turbo=2.1.5.1 + - liblapack=3.9.0 + - libopenblas=0.3.24 + - libpng=1.6.39 + - libsqlite=3.43.0 + - libtiff=4.6.0 + - libwebp-base=1.3.2 + - libxcb=1.15 + - libzlib=1.2.13 + - llvm-openmp=16.0.6 + - matplotlib=3.8.0 + - matplotlib-base=3.8.0 + - munkres=1.1.4 + - ncurses=6.4 + - numpy=1.26.0 + - openjpeg=2.5.0 + - openssl=3.1.2 + - packaging=23.1 + - pandas=2.1.0 + - pillow=10.0.1 + - pip=23.2.1 + - pthread-stubs=0.4 + - pyparsing=3.1.1 + - python=3.10.12 + - python-dateutil=2.8.2 + - python-tzdata=2023.3 + - python_abi=3.10 + - pytz=2023.3.post1 + - readline=8.2 + - scikit-learn=1.3.0 + - scipy=1.11.2 + - setuptools=68.2.2 + - six=1.16.0 + - threadpoolctl=3.2.0 + - tk=8.6.12 + - tornado=6.3.3 + - tzdata=2023c + - unicodedata2=15.0.0 + - wheel=0.41.2 + - xorg-libxau=1.0.11 + - xorg-libxdmcp=1.1.3 + - xz=5.2.6 + - zstd=1.5.5 +prefix: /Users/xiao_deng/miniforge3/envs/Q3 diff --git a/Q3/psudo_result.csv b/Q3/psudo_result.csv new file mode 100644 index 0000000..6bbbc1d --- /dev/null +++ b/Q3/psudo_result.csv @@ -0,0 +1,102 @@ +Sample ID,Gender,Age,AI pred,Ground truth +S_0,Male,42.0,0.183843222651211,No Sick +S_1,Male,54.0,0.032451971485353635,No Sick +S_2,Male,27.0,0.1649091208860276,No Sick +S_3,Female,51.0,0.9838273079563034,Sick +S_4,Female,32.0,0.7008005948749091,No Sick +S_5,Female,50.0,0.04646539805577132,No Sick +S_6,Female,63.0,0.37605963432485756,No Sick +S_7,Male,48.0,0.5221502126827561,Sick +S_8,Female,43.0,0.6380703073440606,No Sick +S_9,Male,50.0,0.16000187268400592,No Sick +S_10,Female,33.0,0.8684964025015954,No Sick +S_11,Female,52.0,0.6292457724763052,No Sick +S_12,Male,49.0,0.4549646243576516,Sick +S_13,Female,26.0,0.5097453569913539,No Sick +S_14,Female,60.0,0.3337711914417254,No Sick +S_15,Female,48.0,0.019190399941885428,No Sick +S_16,Male,47.0,0.04086642173184299,No Sick +S_17,Female,54.0,0.18241359146528532,No Sick +S_18,Male,58.0,0.32089169346089924,No Sick +S_19,Female,36.0,0.413237627716878,Sick +S_20,Female,48.0,0.13062595790437023,No Sick +S_21,Female,56.0,0.29018011048552517,No Sick +S_22,Female,53.0,0.2555372095893874,No Sick +S_23,Female,44.0,0.09580993903210833,No Sick +S_24,Male,55.0,0.6877916599706746,Sick +S_25,Male,56.0,0.40153291103181854,Sick +S_26,Male,44.0,0.17088154472476824,No Sick +S_27,Male,60.0,0.28903419437712474,No Sick +S_28,Male,39.0,0.3059480568045402,No Sick +S_29,Female,51.0,0.30293016203624257,No Sick +S_30,Male,32.0,0.5986074572752382,Sick +S_31,Male,61.0,0.1679725784069874,No Sick +S_32,Female,20.0,0.19933363134841395,No Sick +S_33,Female,75.0,0.2936272223993208,No Sick +S_34,Female,60.0,0.38458266378064254,No Sick +S_35,Female,36.0,0.5476216653350379,No Sick +S_36,Female,22.0,0.2540285986407038,No Sick +S_37,Female,41.0,0.30688487550042554,No Sick +S_38,Male,58.0,0.010881451914966034,No Sick +S_39,Female,57.0,0.3141640693118162,No Sick +S_40,Female,57.0,0.19447009952931774,No Sick +S_41,Male,49.0,0.33065208227575404,Sick +S_42,Female,59.0,0.751020059639999,Sick +S_43,Male,73.0,0.2874468176061555,No Sick +S_44,Male,47.0,0.12089859681706382,No Sick +S_45,Male,66.0,0.17528475949731379,No Sick +S_46,Female,64.0,0.8819982427894725,No Sick +S_47,Female,42.0,0.5005003573463266,No Sick +S_48,Female,43.0,0.2745791003849961,No Sick +S_49,Female,45.0,0.4161238121442544,No Sick +S_50,Male,35.0,0.41528904708151504,No Sick +S_51,Female,52.0,0.8146647348503631,No Sick +S_52,Male,49.0,0.17604193457147554,No Sick +S_53,Male,53.0,0.05322796458244725,No Sick +S_54,Female,45.0,0.4299485265172557,No Sick +S_55,Female,63.0,0.35375757738991287,No Sick +S_56,Male,37.0,0.2164630863950512,No Sick +S_57,Female,43.0,0.7542813473217973,No Sick +S_58,Male,40.0,0.12277033509439539,No Sick +S_59,Male,57.0,0.028993766542943746,No Sick +S_60,Male,63.0,0.1840667841524664,No Sick +S_61,Female,42.0,0.9182713866681889,No Sick +S_62,Female,38.0,0.4997258327162861,No Sick +S_63,Female,27.0,0.057822477359941504,No Sick +S_64,Male,45.0,0.2869275808238832,No Sick +S_65,Male,56.0,0.27075663892334423,No Sick +S_66,Female,78.0,0.5147121232117046,Sick +S_67,Male,57.0,0.4303055422658295,Sick +S_68,Female,65.0,0.5790290855646982,No Sick +S_69,Male,34.0,0.4488264948240428,No Sick +S_70,Male,52.0,0.31922894933435064,No Sick +S_71,Male,48.0,0.2704984074393081,No Sick +S_72,Female,57.0,0.5318201811015301,No Sick +S_73,Female,45.0,0.915191370314399,No Sick +S_74,Male,33.0,0.16627710406505336,No Sick +S_75,Male,57.0,0.9744135322178493,Sick +S_76,Male,36.0,0.3890723811007448,No Sick +S_77,Male,50.0,0.4782644098424499,No Sick +S_78,Female,33.0,0.5124992859909004,Sick +S_79,Male,36.0,0.11506051247073344,No Sick +S_80,Male,62.0,0.3673796432900976,No Sick +S_81,Male,56.0,0.061334487122536044,No Sick +S_82,Female,50.0,0.5792648132889187,No Sick +S_83,Female,55.0,0.33218576134014133,No Sick +S_84,Male,39.0,0.32085392248494365,No Sick +S_85,Male,34.0,0.04450511997589546,No Sick +S_86,Male,67.0,0.15133055497828424,No Sick +S_87,Female,50.0,0.18709959213671942,No Sick +S_88,Male,53.0,0.10073701418285581,No Sick +S_89,Male,35.0,0.5110592056032592,Sick +S_90,Male,38.0,0.8793802677769047,Sick +S_91,Female,47.0,0.1247705954358479,No Sick +S_92,Female,51.0,0.23236933325127848,No Sick +S_93,Female,64.0,0.5361768277573149,No Sick +S_94,Male,39.0,0.7145348867998527,Sick +S_95,Female,49.0,0.8949969712274917,No Sick +S_96,Female,51.0,0.4008792149067575,No Sick +S_97,Female,51.0,0.37491428399612803,No Sick +S_98,Female,39.0,0.3545989884164421,No Sick +S_99,Male,51.0,0.26829780510576695,No Sick +,,,, diff --git a/Q3/report.pptx b/Q3/report.pptx new file mode 100644 index 0000000..db07c87 Binary files /dev/null and b/Q3/report.pptx differ diff --git a/Q3/roc_curve.png b/Q3/roc_curve.png new file mode 100644 index 0000000..9c4b8a1 Binary files /dev/null and b/Q3/roc_curve.png differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..5ad9549 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# everfortuneai_interview + +長佳智能AI工程師面試2023 \ No newline at end of file diff --git a/上機考題_v5.txt b/上機考題_v5.txt new file mode 100644 index 0000000..94c4b0e --- /dev/null +++ b/上機考題_v5.txt @@ -0,0 +1,21 @@ +第一題 +1. 目標:將HandBoneXRay.zip影像中的黑背景去掉,並轉正手部X光影像。當你成功開啟dicom檔影像之後,你會發現有部份影像不是整張都是手部X光影像,看起來像是X光影像丟在某個黑色背景上再翻拍成電子檔。例如 +22b63b2c78bc96711c0af031585f327874f56f18a5f42a6a7f004b8ce4a8ed26.dcm +這個檔就有這個現象。如果看不出來,調整一下對比度(window level)。 +2. 交付項目:將處理好的影像存成同檔名的dicom檔,共十張。處理的程式碼,py檔或notebook檔都可以。 +3. 內容要求:請使用python處理,搭配pydicom模組。 + +第二題 +讓使用者輸入一個由()AOTF 等字元構成的字串,程式運算輸出 T 或 F 或 E。 +符號與運算方式說明如下:T 代表 True,F 代表 False,A 代表 and,O 代表 +or,運算優先順序為括號內先運算、由左到右運算。 +TAT = TOF = FOT = T +TAF = FAT = FOF = F +若輸入的字串語法錯誤則輸出 E。例如: +輸入 TA(TOFAT)OF,輸出 T; +輸入 TATT,輸出 E。 +PS.禁用eval()函數 +TOFOF + +第三題 +附件psudo_result.csv中是某POC (proof of concept) AI測試集的結果,這個AI是拿來用在預測急診室中的某項檢傷分類疾病,該模型的輸入是胸腔X光影像。假設你是這個AI模型的開發者,請根據這個表格整理成一份不得超過兩頁的投影片報告。報告目標至少呈現AI的performance以及建議。使用MS power point或者google投影片製作皆可。