* Builds object-detection model from MobileNet. * * @returns {[tf.Model, tf.layers.Layer[]]} * 1. The newly-built model for simple object detection. * 2. The layers that can be unfrozen during fine-tuning.
()
| 128 | * 2. The layers that can be unfrozen during fine-tuning. |
| 129 | */ |
| 130 | async function buildObjectDetectionModel() { |
| 131 | const {truncatedBase, fineTuningLayers} = await loadTruncatedBase(); |
| 132 | |
| 133 | // Build the new head model. |
| 134 | const newHead = buildNewHead(truncatedBase.outputs[0].shape.slice(1)); |
| 135 | const newOutput = newHead.apply(truncatedBase.outputs[0]); |
| 136 | const model = tf.model({inputs: truncatedBase.inputs, outputs: newOutput}); |
| 137 | |
| 138 | return {model, fineTuningLayers}; |
| 139 | } |
| 140 | |
| 141 | (async function main() { |
| 142 | // Data-related settings. |
no test coverage detected