The Japanese themselves knew that they could not win the war in 1944:
> Rear Adm. Soichi Takagi, who was attached to the ministerial secretariat of the Naval General Staff, made a study between 20 September 1943 and February 1944, of the war's battle lesson up to that time. He conclude that Japan could not win and verbally presented his findings in March 1944 to Admiral Mitsumasa Yonai and Vice Adm. Seibi Inouye. Takagi's study, interestingly enough, was undertaken at the end of the second year of the war--the time beyond which, the Japanese Navy's top command had estimated before hostilities, Japan could not fight a successful war. Takagi's estimate was based on an analysis of fleet, air, and merchant ship losses suffered to date, the serious difficulties in acquiring essential imported materials, the internal confusion in Japan, and a growing feeling among the "intelligentsia" that Tojo should be let out. It seemed clear to Takagi that potential long-range air attacks on the home islands and Japan's inability to import essential materials for production had created a situation which dictated that Japan should seek a compromise peace. In Takagi's view Japan at this time should have envisaged withdrawing from China and giving up both Korea and Formosa as part of the peace terms. His study in any case documented the fears Yonai and others held before the war and lent support to the increasing but still carefully guarded concern of their fellow Jushin that all was not well with Tojo's prosecution of the war.
* https://www.history.navy.mil/research/library/online-reading...
Yet they continued to fight in the hopes of grinding down the US' will to fight and get better terms.
Even so, a military group attempted a coup to stop the surrender the night before - after the emperor's surrender message had been recorded but before it was broadcast.
After the invasion of Okinawa but before the atomic bombs, Japan was a country that was clearly militarily defeated, but not close to surrender.