  The distribution of matter that is measured through galaxy redshift and
peculiar velocity surveys can be harnessed to learn about the physics of dark
matter, dark energy, and the nature of gravity. To improve our understanding of
the matter of the Universe, we can reconstruct the full density and velocity
fields from the galaxies that act as tracer particles. In this paper, we use
the simulated halos as proxies for the galaxies. We use a convolutional neural
network, a V-net, trained on numerical simulations of structure formation to
reconstruct the density and velocity fields. We find that, with detailed tuning
of the loss function, the V-net could produce better fits to the density field
in the high-density and low-density regions, and improved predictions for the
probability distribution of the amplitudes of the velocities. However, the
weights will reduce the precision of the estimated $\beta$ parameter. We also
find that the redshift-space distortions of the halo catalogue do not
significantly contaminate the reconstructed real-space density and velocity
field. We estimate the velocity field $\beta$ parameter by comparing the
peculiar velocities of halo catalogues to the reconstructed velocity fields,
and find the estimated $\beta$ values agree with the fiducial value at the 68\%
confidence level.
