OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Create a model to detect age according to conditions [closed]

  • Thread starter Thread starter user25633742
  • Start date Start date
U

user25633742

Guest
I have to create a model for detecting age based on color of clothes of males and females in a meeting room. The two specific conditions provided are that if the person in image has worn white clothes, the predicted age should be 23 and if the clothes are black, the person should be declared as a child. I'm a beginner at python and am encountering this difficulty. The output I'm getting is returning '<function age at 0x000002218F1ED620>'. The code i am using is given below. Please help me.

Code:
fldr= "./Dataset"
import os
files= os.listdir(fldr)
ages=[]
colors=[]
images=[]
for fle in files:
    color=str(fle.split('_')[2])
    
    total=fldr +'/'+ fle
    print(total)
    image= cv2.imread(total)

    image=cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
    image=cv2.resize(image,(400,400))
    images.append(image)


    def age(color):
        if color == 'white':
           age == 23
        elif color == 'black':
             age == 'child'
        else:
             age = int(fle.split('_')[0])
        return age     
    ages.append(age)
    colors.append(color)

print(ages[10])

The output I'm getting is <function age at 0x000002218F1ED8A0>
<p>I have to create a model for detecting age based on color of clothes of males and females in a meeting room. The two specific conditions provided are that if the person in image has worn white clothes, the predicted age should be 23 and if the clothes are black, the person should be declared as a child. I'm a beginner at python and am encountering this difficulty. The output I'm getting is returning '<function age at 0x000002218F1ED620>'. The code i am using is given below. Please help me.</p>
<pre class="lang-py prettyprint-override"><code>fldr= "./Dataset"
import os
files= os.listdir(fldr)
ages=[]
colors=[]
images=[]
for fle in files:
color=str(fle.split('_')[2])

total=fldr +'/'+ fle
print(total)
image= cv2.imread(total)

image=cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
image=cv2.resize(image,(400,400))
images.append(image)


def age(color):
if color == 'white':
age == 23
elif color == 'black':
age == 'child'
else:
age = int(fle.split('_')[0])
return age
ages.append(age)
colors.append(color)

print(ages[10])
</code></pre>
<p>The output I'm getting is <function age at 0x000002218F1ED8A0></p>
 

Latest posts

U
Replies
0
Views
1
user3658366
U
G
Replies
0
Views
1
Giampaolo Levorato
G
M
Replies
0
Views
1
Marcelo Rodrigo Nascimento
M
Top