| 1605 | |
| 1606 | |
| 1607 | void nmsInit(XlayerData *xlayer_seq, xChangeLayer *currentLayer, file_paths *const_data_path) |
| 1608 | { |
| 1609 | #if EN_DEBUG_INIT_PRINT |
| 1610 | cout<<"nmsInit Start : "<<endl; |
| 1611 | #endif |
| 1612 | |
| 1613 | |
| 1614 | int *nms_params = (int *)xlayer_seq->hw_ops->nms_params; |
| 1615 | |
| 1616 | vector<int> bottomShape = xlayer_seq->hw_ops->bottomShape.at(0);//.blob->shape; |
| 1617 | vector<int> topShape = xlayer_seq->hw_ops->topShape.at(0);//.blob->shape; |
| 1618 | |
| 1619 | int *scalar_nms_args = (int *)currentLayer->params; |
| 1620 | |
| 1621 | |
| 1622 | scalar_nms_args[1] = xlayer_seq->hw_ops->nms_params->num_classes; |
| 1623 | scalar_nms_args[2] = xlayer_seq->hw_ops->nms_params->nms_top_k; |
| 1624 | scalar_nms_args[3] = xlayer_seq->hw_ops->nms_params->keep_top_k; |
| 1625 | scalar_nms_args[4] = xlayer_seq->hw_ops->nms_params->confidence_threshold; |
| 1626 | scalar_nms_args[5] = xlayer_seq->hw_ops->nms_params->nms_threshold; |
| 1627 | scalar_nms_args[6] = XBATCH_SIZE; |
| 1628 | scalar_nms_args[7] = currentLayer->qf_format.ip_fbits; |
| 1629 | scalar_nms_args[8] = currentLayer->en_batch_size_one; //BATCH_SIZE_ONE_ENABLE |
| 1630 | |
| 1631 | int ip_bw = xlayer_seq->hw_ops->ip_bw; |
| 1632 | float th_in = 0; |
| 1633 | |
| 1634 | //# Flag for quantization scheme |
| 1635 | //# Set to 1 for Offline quant mode otherwise zero |
| 1636 | scalar_nms_args[10] = 0;///0;//TODO:debug NMS offline:ANITHA |
| 1637 | |
| 1638 | #if 0 |
| 1639 | //# Check for offline quant mode and load input threshold value |
| 1640 | if(xlayer_seq->hw_ops->quantization_scheme.compare("Xilinx") == 0) |
| 1641 | { |
| 1642 | th_in = xlayer_seq->hw_ops->th_layer_in; |
| 1643 | scalar_nms_args[10] = 1; |
| 1644 | } |
| 1645 | #if 0 |
| 1646 | float sf_in = th_in / (pow(2, ip_bw - 1) - 1); |
| 1647 | |
| 1648 | scalar_nms_args[9] = *((int *)(&sf_in)); |
| 1649 | #endif |
| 1650 | #endif |
| 1651 | |
| 1652 | float confidence_threshold = xlayer_seq->hw_ops->nms_params->confidence_threshold; |
| 1653 | float nms_threshold = xlayer_seq->hw_ops->nms_params->nms_threshold; |
| 1654 | |
| 1655 | currentLayer->float_params.push_back(confidence_threshold); |
| 1656 | currentLayer->float_params.push_back(nms_threshold); |
| 1657 | |
| 1658 | scalar_nms_args[11] = *((int *)(&confidence_threshold)); |
| 1659 | scalar_nms_args[12] = *((int *)(&nms_threshold)); |
| 1660 | |
| 1661 | |
| 1662 | #if 0 |
| 1663 | string quant_scheme = xlayer_seq->hw_ops->quantization_scheme; |
| 1664 |
no test coverage detected