  Using single-pixel detection, the end-to-end neural network that jointly
optimizes both encoding and decoding enables high-precision imaging and
high-level semantic sensing. However, for varied sampling rates, the
large-scale network requires retraining that is laboursome and
computation-consuming. In this letter, we report a weighted optimization
technique for dynamic rate-adaptive single-pixel imaging and sensing, which
only needs to train the network for one time that is available for any sampling
rates. Specifically, we introduce a novel weighting scheme in the encoding
process to characterize different patterns' modulation efficiency. While the
network is training at a high sampling rate, the modulation patterns and
corresponding weights are updated iteratively, which produces optimal ranked
encoding series when converged. In the experimental implementation, the optimal
pattern series with the highest weights are employed for light modulation, thus
achieving highly-efficient imaging and sensing. The reported strategy saves the
additional training of another low-rate network required by the existing
dynamic single-pixel networks, which further doubles training efficiency.
Experiments on the MNIST dataset validated that once the network is trained
with a sampling rate of 1, the average imaging PSNR reaches 23.50 dB at 0.1
sampling rate, and the image-free classification accuracy reaches up to 95.00\%
at a sampling rate of 0.03 and 97.91\% at a sampling rate of 0.1.
