Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
267 views
in Technique[技术] by (71.8m points)

pandas - How do you compile mixed data types for tensorflow?

I am trying to make a mixed dataset but I am struggling. I want to use an image and float value for the inputs. Then output a linear regression. I've tried researching for hours but many tutorials used preassembled datasets which wasn't much help in my case. Can someone teach me how I could plug this data into a model.fit. I don't need help creating a model.
I am currently using:
python 3.8
tf-gpu 2.4.0rc1
keras 2.4.3
pandas 1.1.4

This is where I got stuck.

IMG_SIZE = 400
Version = 1
batch_size = 8

val_aug = ImageDataGenerator(rescale=1/255)
aug = ImageDataGenerator(
        rescale=1/255, 
        rotation_range=30, 
        width_shift_range=0.1, 
        height_shift_range=0.1, 
        shear_range=0.2, 
        zoom_range=0.2, 
        channel_shift_range=25, 
        horizontal_flip=True, 
        fill_mode='constant')

image_file_list = glob('F:/DATA/Vote/Images/**', recursive=True)
df = pd.read_csv('F:/DATA/Vote/Vote_Age.csv', names=["ID", "age", "votes"])

ID = df["ID"].value_counts().keys().tolist()
age = df["age"].value_counts().keys().tolist()
votes = df["votes"].value_counts().keys().tolist()

print(ID)
print(age)
print(votes)

This is what my Text Data looks like, it is compiled into a .csv file. ID is the image name, age is my second input value and votes is my prediction value

ID,age,votes
484,121576.1,-5
482,121576.88,42
477,121582.42,68
475,121587.62,12
474,121587.68,29
469,121602.92,47
467,121603.0,115
463,121603.17,9
451,121605.08,22
450,121605.68,12
447,121607.97,33
410,121610.36,12
400,121610.76,5
398,121610.93,13
395,121610.99,13
394,121611.0,122
393,121611.02,15
392,121611.02,38
391,121611.04,27
390,121611.05,9
...
question from:https://stackoverflow.com/questions/65546504/how-do-you-compile-mixed-data-types-for-tensorflow

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...