autokeras icon indicating copy to clipboard operation
autokeras copied to clipboard

[Question] Using complex custom modalities with AutoKeras

Open neel04 opened this issue 3 years ago • 1 comments
trafficstars

Firstly, thanks a lot to the authors and maintainers for providing such a versatile and dynamic tool! 🚀

I had a dataset with an image, on which I would like to regress 2 different floats/per image. I believe such a task comes under the Multi-Task category of the documentation.

In such a case where the output heads are actually the same, does something like this work:-

# Initialize the multi with multiple inputs and outputs.
model = ak.AutoModel(
    inputs=[ak.ImageInput()],
    outputs=[
        ak.RegressionHead(metrics=["mae"]),
        ak.RegressionHead(metrics=["mae"])), # 2 regression heads, for 2 continuous variables
    ],
    overwrite=True,
    max_trials=2,

I assume that its computing something like how torch does behind the scenes

criterion_1 = MAE()
criterion_2 = MAE()
loss = criterion_1(regression_head_1, gt_1) + criterion_2(regression_head_2, gt_2)
loss.backward()
......

Where it forms 2 different criteria and is backpropagated together.

So would passing my data with such an architecture be enough for AutoKeras to backprop? if there are modifications to be made, could you kindly provide me with the base files where I can start from?

  • and just a last teeny question, my ground truth targets are pretty small, near about 1e-3 or so. Should I artificially scale them with a multiplier, or does AutoKeras handle the scaling on its own?

Many Many Thanks 🤗

neel04 avatar Nov 29 '21 23:11 neel04

@haifeng-jin I know you might be busy with a lot of work, but if you could just take out 2 minutes and provide some guidance; it would be very, very welcome!

neel04 avatar Dec 01 '21 17:12 neel04