Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita951f9b

Browse files
committed
added skin cancer detection tutorial
1 parent9469e9f commita951f9b

File tree

6 files changed

+1394
-0
lines changed

6 files changed

+1394
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
4545
-[How to Use K-Means Clustering for Image Segmentation using OpenCV in Python](https://www.thepythoncode.com/article/kmeans-for-image-segmentation-opencv-python). ([code](machine-learning/kmeans-image-segmentation))
4646
-[How to Perform YOLO Object Detection using OpenCV and PyTorch in Python](https://www.thepythoncode.com/article/yolo-object-detection-with-opencv-and-pytorch-in-python). ([code](machine-learning/object-detection))
4747
-[How to Blur Faces in Images using OpenCV in Python](https://www.thepythoncode.com/article/blur-faces-in-images-using-opencv-in-python). ([code](machine-learning/blur-faces))
48+
-[Skin Cancer Detection using TensorFlow in Python](https://www.thepythoncode.com/article/skin-cancer-detection-using-tensorflow-in-python). ([code](machine-learning/skin-cancer-detection))
4849
-[Building a Speech Emotion Recognizer using Scikit-learn](https://www.thepythoncode.com/article/building-a-speech-emotion-recognizer-using-sklearn). ([code](machine-learning/speech-emotion-recognition))
4950
-[How to Convert Speech to Text in Python](https://www.thepythoncode.com/article/using-speech-recognition-to-convert-speech-to-text-python). ([code](machine-learning/speech-recognition))
5051
-[Top 8 Python Libraries For Data Scientists and Machine Learning Engineers](https://www.thepythoncode.com/article/top-python-libraries-for-data-scientists).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[Skin Cancer Detection using TensorFlow in Python](https://www.thepythoncode.com/article/skin-cancer-detection-using-tensorflow-in-python)
2+
To follow along, run:
3+
-`pip3 install -r requirements.txt`
4+
5+
Full code is at:
6+
- Notebook:`skin-cancer-detection.ipynb`
7+
- Script:`skin-cancer-detection.py`
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
importglob
2+
importos
3+
importargparse
4+
5+
importpandasaspd
6+
7+
8+
defgenerate_csv(folder,labels):
9+
folder_name=os.path.basename(folder)
10+
# convert comma separated labels into a list
11+
label2int= {}
12+
iflabels:
13+
labels=labels.split(",")
14+
forlabelinlabels:
15+
string_label,integer_label=label.split("=")
16+
label2int[string_label]=integer_label
17+
18+
labels=list(label2int)
19+
# generate CSV file
20+
df=pd.DataFrame(columns=["filepath","label"])
21+
i=0
22+
forlabelinlabels:
23+
print("Reading",os.path.join(folder,label,"*"))
24+
forfilepathinglob.glob(os.path.join(folder,label,"*")):
25+
df.loc[i]= [filepath,label2int[label]]
26+
i+=1
27+
28+
df.to_csv(f"{folder_name}.csv")
29+
30+
31+
32+
if__name__=="__main__":
33+
parser=argparse.ArgumentParser(description="CSV Metadata generator for skin cancer dataset from ISIC")
34+
parser.add_argument("-f","--folder",help="Dataset portion folder, e.g: /root/skin-disease/test and not the whole dataset",
35+
required=True)
36+
parser.add_argument("-l","--labels",help="The different skin disease classes along with label encoding separated in commas,\
37+
e.g: Binary classification between malignant and benign categories, something like this:\
38+
nevus=0,seborrheic_keratosis=0,melanoma=1",
39+
required=True)
40+
# parse arguments
41+
args=parser.parse_args()
42+
folder=args.folder
43+
labels=args.labels
44+
# generate the CSV file
45+
generate_csv(folder,labels)
46+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tensorflow
2+
tensorflow_hub
3+
matplotlib
4+
numpy
5+
pandas
6+
seaborn
7+
sklearn
8+
imblearn

‎machine-learning/skin-cancer-detection/skin-cancer-detection.ipynb

Lines changed: 951 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp