How to specify the number of filters for a Conv1D?

I’m looking to implement a ResNet with a Conv1D, but I don’t quite understand how to specify the number of filters? My data has 161 channels, so my in_channels and out_channels is set to 161. But How would I specify that I want 64 filters?

The out_channels specify the number of filters, so you could use out_channels=64.
CS231n gives a good overview about the shapes and methods used for convolutions.

I understand in the 2d sense. But for a 1D, I have 161 in channels, so going down to 64 would be a reduction. Normally, I think, I’d want an increase in number of filters (at least that’s what I’ve seen for most 2D CNNs).

Yes, usually you would increase the filters at the beginning at least.
The number of filters for 1D and 2D convolutions are defined in the same sense.

I think it depends on your use case, if a channel reduction at the beginning will work fine or not.
E.g. if your input data contains some redundant channels, it might work fine, otherwise you might lose too much information.

Have you tried different approaches and see a specific pattern in the model performance regarding the number of channels?