A data transmission method, comprising: Sending, by a terminal in a grant-free mode, first data to a network device by using a grant-free resource; and if the terminal needs to switch from the grant-free mode to a grant mode, sending, by the terminal in the grant mode, second data to the network device by using a grant resource; wherein the terminal needs to switch from the grant-free mode to the grant mode comprises: receiving, by the terminal, an acknowledge frame sent by the network device; obtaining first instruction information that is comprised in the acknowledge frame and used to instruct the terminal to switch from the grant-free mode to the grant mode; and determining, according to the first instruction information, that the terminal needs to switch from the grant-free mode to the grant mode; or receiving, by the terminal, an acknowledge frame sent by the network device; and determining, when determining that a resource used by the acknowledge frame is one of a plurality of preset instruction resources, that the terminal needs to switch from the grant-free mode to the grant mode, wherein any one of the plurality of preset instruction resources is a resource used to instruct the terminal to switch from the grant-free mode to the grant mode. Sending, by a terminal in a grant-free mode, first data to a network device by using a grant-free resource; and if the terminal needs to switch from the grant-free mode to a grant mode, sending, by the terminal in the grant mode, second data to the network device by using a grant resource; wherein the terminal needs to switch from the grant-free mode to the grant mode comprises: receiving, by the terminal, an acknowledge frame sent by the network device; obtaining first instruction information that is comprised in the acknowledge frame and used to instruct the terminal to switch from the grant-free mode to the grant mode; and determining, according to the first instruction information, that the terminal needs to switch from the grant-free mode to the grant mode; or receiving, by the terminal, an acknowledge frame sent by the network device; and determining, when determining that a resource used by the acknowledge frame is one of a plurality of preset instruction resources, that the terminal needs to switch from the grant-free mode to the grant mode, wherein any one of the plurality of preset instruction resources is a resource used to instruct the terminal to switch from the grant-free mode to the grant mode. receiving, by the terminal, an acknowledge frame sent by the network device; obtaining first instruction information that is comprised in the acknowledge frame and used to instruct the terminal to switch from the grant-free mode to the grant mode; and determining, according to the first instruction information, that the terminal needs to switch from the grant-free mode to the grant mode; or receiving, by the terminal, an acknowledge frame sent by the network device; and determining, when determining that a resource used by the acknowledge frame is one of a plurality of preset instruction resources, that the terminal needs to switch from the grant-free mode to the grant mode, wherein any one of the plurality of preset instruction resources is a resource used to instruct the terminal to switch from the grant-free mode to the grant mode.