0

I have an array of strings. Each row of the string contains 1440 "numbers". Using the code below the program runs fine but when I check the feature column via pgAdmin it is empty. The column "image" which contains the path of the image and is primary key, is filled correctly. If I try to save the feature into "image" columns I get an error that there is now enough space:

index row size 2896 exceeds maximum 2712 for index

But I don't think that this is a problem when I save the array into "feature" column because I get no error.

for imagePath in glob.glob(args["dataset"] + "/*.jpg"):
    # Get the image
    imageID = imagePath[imagePath.rfind("/") + 1:]
    image = cv2.imread(imagePath)

    # Find the features
    features = cd.describe(image)

    # Put the features into DB
    features = [str(f) for f in features]
    cursor.execute("insert into index (image,feature) values (%s,%s);",  (imageID,features))
    conn.commit()

conn.close() 

UPDATE: It seems that it was a pgAdmin related problem, because if I fetch the column I get all the numbers.

user1798707
  • 351
  • 1
  • 3
  • 12

1 Answers1

1

you have an index on a column, and you are trying to insert data that is too wide for that index. if you don't need ordering on that index switching to a hash index may be a good solution, else you need to rethink it.

Jasen
  • 11,837
  • 2
  • 30
  • 48