Closed visionNoob closed 5 years ago
Keras backbone from 'keras.application' class allows users to extract intermediate layers by doing like the code below.
sample code:
model = keras.applications.DenseNet169(
input_shape=input_shape, include_top=False)
# frozen
model.trainable = False
x1_1 = GlobalAveragePooling2D()(model.layers[-1].output)
x1_2 = GlobalAveragePooling2D()(model.layers[-9].output)
x1_3 = GlobalAveragePooling2D()(model.layers[-23].output)
`
backbone network는 keras-retinanet에서는 resnet을 backbone으로 쓰는데 https://github.com/broadinstitute/keras-resnet 이놈을 씁니다. keras base를 쓰지 않는 이유는 retinanet의 feature pyramid network가 boackbone의 중간(intermediate) 특징맵을 뜯어서 쓰는 형태인데 아래 참조
https://github.com/fizyr/keras-retinanet/blob/cfaa25ce61bb32cb05f1916f8372425162cc8fcd/keras_retinanet/models/retinanet.py#L276
요거 때문에 그런건지 모르겠습니다.