Go through the following steps to segment the skins using scikit-learn's GaussianMixture:
- Read the training dataset that you downloaded as a pandas DataFrame:
df = pd.read_csv('images/Skin_NonSkin.txt', header=None, delim_whitespace=True)df.columns = ['B', 'G', 'R', 'skin']
The next screenshot shows what the first few rows of the data look like:
- Plot the distribution of the RGB values for skin and nonskin examples separately, using boxplot:
g = sns.factorplot(data=pd.melt(df, id_vars='skin'), \ x='variable', y='value', hue='variable', col='skin', \ kind='box', palette=sns.color_palette("hls", 3)[::-1])plt.show()
If you ...