This commit is contained in:
Glenn Jocher 2019-08-29 18:58:09 +02:00
parent 894fc1c47f
commit 12b169158f
2 changed files with 24 additions and 1 deletions

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
# Start from Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
FROM nvcr.io/nvidia/pytorch:19.07-py3
# Install dependencies
RUN pip3 install -U -r requirements.txt
# Move file into container
# RUN mv 1047.tif ./1047.tif
# Move model into container
# RUN mv yolov3-spp.pt ./weights
# --------------------------------------------------- Extras Below ---------------------------------------------------
# Build container
# sudo docker image prune -a && sudo docker build -t friendlyhello . && sudo docker tag friendlyhello ultralytics/yolov3:v0
# Run container
# time sudo docker run -it --memory=8g --cpus=4 ultralytics/yolov3:v0 bash -c './run.sh /1047.tif /tmp && cat /tmp/1047.tif.txt'
# Push container to https://hub.docker.com/u/ultralytics
# sudo docker push ultralytics/xview:v30

View File

@ -291,7 +291,7 @@ def wh_iou(box1, box2):
class FocalLoss(nn.Module):
# Wraps focal loss around existing loss_fcn() https://arxiv.org/pdf/1708.02002.pdf
# i.e. criteria = FocalLoss(nn.BCEWithLogitsLoss(), gamma=2.5)
def __init__(self, loss_fcn, alpha=1, gamma=2, reduction='mean'):
def __init__(self, loss_fcn, alpha=1, gamma=0.5, reduction='mean'):
super(FocalLoss, self).__init__()
loss_fcn.reduction = 'none' # required to apply FL to each element
self.loss_fcn = loss_fcn