<jupyter_start><jupyter_text>EDA<jupyter_code>df.describe()
df['size'].plot(kind='box')
plt.hist(df['size'],bins=20)
plt.show()<jupyter_output><empty_output><jupyter_text>So, from analysis i will resize all the image to 100 *  100 form and remove image with size less or equal 54<jupyter_code>df_new=df[df['size']>60]
df_new
def gender(string):
    try:
        return string.split("_")[0].split("/")[-1]
    except:
        return None
df_new['gender']=df_new['path'].apply(gender)
df_new
print(df_new['gender'].value_counts(normalize=True))
df_new['gender'].value_counts(normalize=True).plot(kind='bar')<jupyter_output>male      0.726027
female    0.273973
Name: gender, dtype: float64<jupyter_text>1. 73% male are there and rest are female2. All the Image size is greater than or equal to 81Conclusion resizing all the image in the df_new to 100 x 100<jupyter_code>df_new['size'].min()<jupyter_output><empty_output><jupyter_text>RESIZE IMAGE<jupyter_code>def resize_img(path_to_resize):
    try:
        # step -1 : read image 
        img=cv.imread(path_to_resize)
        # step - 2: convert into grayscale
        gray=cv.cvtColor(img,cv.COLOR_BGR2GRAY)
        size=gray.shape[0]
        if size>=100:#large
            gray_re=cv.resize(gray,(100,100),cv.INTER_AREA)
        else:#small
            gray_re=cv.resize(gray,(100,100),cv.INTER_CUBIC)
        #flatten image (1x10,100)
        return gray_re.flatten()
    except:
        return None

df_new['structured_data']=df_new['path'].apply(resize_img)
df_new
#copy and expand their columns
df1=df_new['structured_data'].apply(pd.Series)
df1
df2=pd.concat([df_new['gender'],df1],axis=1)
df2
plt.imshow(df2.loc[0][1:].values.reshape(100,100).astype('int'),cmap='gray')
plt.title(df2.loc[0]['gender'])
import pickle
pickle.dump(df2,open('./DATA/dataframe_images_100_100.pickle','wb'))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14941302027748132, 'fraction_numerical': 0.04855923159018143, 'mean_word_length': 4.9523809523809526, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '145795', 'license': 'MIT', 'n_tokens_mistral': 764, 'n_tokens_neox': 698, 'n_words': 119, 'path': 'MODULE-3 STRUCTURING DATA.ipynb', 'repo_name': 'Shekharmaheswari85/Face-Recognition-Using-Haar-Cascade', 'size': '1874'}