Open jianing-sun opened 6 years ago
YOLO head is different, because YOLO divides the output in a grid, and each cell with N anchors, also the loss function is different, so YOLO is not just an architecture
You can use a pretrained MobileNet (imagenet) for the feature extractor instead of Darknet , but you'll still need the custom loss function for the model to predict bounding box, confidence and classes.
Here's an example I've been using in Keras based on this source : YOLO_ResNet
import keras.applications as ka
mobilenet_model = ka.mobilenetv2.MobileNetV2(weights="imagenet", include_top=False, input_shape = (224,224,3))
model = k.models.Sequential()
model.add(mobilenet_model)
model.add(AveragePooling2D((7, 7), name="avg_pool"))
###------------- YOLO Classifier layer -----------###
model.add(Flatten(name='yolo_clf_0'))
model.add(Dense(2048, activation='relu', name='yolo_clf_1'))
model.add(Dropout(0.5, name="yolo_clf_2"))
model.add(Dense(Grid * Grid* (NumClasses + NumBoundingB * 5), activation="linear", name="yolo_clf_3"))
@jpdoiron Great work! Thanks a lot for your kind reply!
You can use a pretrained MobileNet (imagenet) for the feature extractor instead of Darknet , but you'll still need the custom loss function for the model to predict bounding box, confidence and classes.
Here's an example I've been using in Keras based on this source : YOLO_ResNet
import keras.applications as ka mobilenet_model = ka.mobilenetv2.MobileNetV2(weights="imagenet", include_top=False, input_shape = (224,224,3)) model = k.models.Sequential() model.add(mobilenet_model) model.add(AveragePooling2D((7, 7), name="avg_pool")) ###------------- YOLO Classifier layer -----------### model.add(Flatten(name='yolo_clf_0')) model.add(Dense(2048, activation='relu', name='yolo_clf_1')) model.add(Dropout(0.5, name="yolo_clf_2")) model.add(Dense(Grid * Grid* (NumClasses + NumBoundingB * 5), activation="linear", name="yolo_clf_3"))
Please share code...
Hi everyone, I have a question about YOLO and MobileNet: If we use MobileNet backend for object detection, then what is the usage of YOLO? My understanding is YOLO is basically a nn structure (darknet19), so is MobileNet. If we chose MobileNet as the network structure, then literally we didn't implement anything about YOLO. Is this correct?
Thanks!