Converting image to vector?

This may be a basic question / me being lazy, but every source that I’ve gotten into lays heavy entire systems and it’s hard to get into models from a higher level (coding) so I’d like to just start with generating a image from a vector, can someone explain what’s going on / how to do it in python?

Need to get labels and the vectors converted:

try:
    label1 = np.asarray(json.loads(request.form['label1']), dtype='float64')
    label2 = np.asarray(json.loads(request.form['label2']), dtype='float64')
    vector1 = np.asarray(json.loads(request.form['vector1']), dtype='float64')
    vector2 = np.asarray(json.loads(request.form['vector2']), dtype='float64')


    new_vectors, new_labels = interpolate(12, vector1, vector2, label1, label2)
    new_ims = sample(new_vectors, new_labels)
  
    result = PIL.Image.fromarray(new_ims)
    result.save("test.png")
    return jsonify([
        [ encode_img(arr) for arr in new_ims ],
        new_vectors.tolist(),
        new_labels.tolist()
    ])
1 Like

Hi @code1, For generating an image from an array in python, please refer to this sample code example. Thank You.